Fix: unconditionally update client status on ping if it doesn't match
ogcore-debian-package/pipeline/head This commit looks good Details
testing/ogcore-api/pipeline/head There was a failure building this commit Details

pull/125/head
Juan Manuel Bardallo 2026-07-22 09:34:19 +02:00
parent 5144aed0df
commit 2bebae09c1
1 changed files with 12 additions and 9 deletions

View File

@ -89,7 +89,7 @@ class StatusController extends AbstractController
$this->logger->info('Heartbeat: client marked as busy', [
'ip' => $data['iph'], 'previous_status' => $previousStatus, 'st' => $data['st'] ?? null,
]);
} elseif ($data['busy'] === false && $previousStatus === ClientStatus::BUSY) {
} elseif ($data['busy'] === false) {
$idleStatusMap = [
'OGL' => ClientStatus::OG_LIVE,
'LNX' => ClientStatus::LINUX,
@ -97,14 +97,17 @@ class StatusController extends AbstractController
'OSX' => ClientStatus::MACOS,
];
$newStatus = $idleStatusMap[$data['st'] ?? ''] ?? ClientStatus::OG_LIVE;
$client->setStatus($newStatus);
$this->logger->info('Heartbeat: client no longer busy', [
'ip' => $data['iph'], 'previous_status' => $previousStatus, 'new_status' => $newStatus, 'st' => $data['st'] ?? null,
]);
} else {
$this->logger->info('Heartbeat: no status change', [
'ip' => $data['iph'], 'current_status' => $previousStatus, 'busy' => $data['busy'], 'st' => $data['st'] ?? null,
]);
if ($previousStatus !== $newStatus) {
$client->setStatus($newStatus);
$this->logger->info('Heartbeat: client status updated based on ping OS', [
'ip' => $data['iph'], 'previous_status' => $previousStatus, 'new_status' => $newStatus, 'st' => $data['st'] ?? null,
]);
} else {
$this->logger->info('Heartbeat: no status change', [
'ip' => $data['iph'], 'current_status' => $previousStatus, 'busy' => $data['busy'], 'st' => $data['st'] ?? null,
]);
}
}
}