fix: accept any 200 status from heartbeat (registered/updated/ok)

The receiver returns 'updated' when re-registering an existing site,
but the code only accepted 'registered', causing false 'HTTP 200 — Unknown' warnings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-05-23 17:29:52 -05:00
parent d2700f96fe
commit 03e0b6d13b
2 changed files with 9 additions and 6 deletions
+4 -3
View File
@@ -829,17 +829,18 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
$app->enqueueMessage('Grafana heartbeat failed: ' . $error, 'warning');
Log::add('Heartbeat failed: ' . $error, Log::WARNING, 'mokowaas');
}
elseif ($code === 200 && ($body['status'] ?? '') === 'registered')
elseif ($code === 200)
{
$status = $body['status'] ?? 'ok';
$app->enqueueMessage(
'Grafana heartbeat: site registered (' . ($body['ds_uid'] ?? '') . ')',
'Grafana heartbeat: ' . $status . ' (' . ($body['ds_uid'] ?? '') . ')',
'message'
);
}
else
{
$msg = sprintf('Grafana heartbeat failed: HTTP %d — %s',
$code, $body['error'] ?? 'Unknown');
$code, $body['error'] ?? $body['message'] ?? 'Unknown');
$app->enqueueMessage($msg, 'warning');
Log::add($msg, Log::WARNING, 'mokowaas');
}