mirror of
https://github.com/Terranom674/Piwigo_Bratonien_Tools.git
synced 2026-09-19 11:44:31 +00:00
Detect stalled manual cache builds in status endpoint
This commit is contained in:
@@ -44,4 +44,13 @@ if (!is_array($data))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$state = (string)($data['state'] ?? 'idle');
|
||||||
|
$updated = (int)($data['updated_at'] ?? 0);
|
||||||
|
if (($state === 'running' || $state === 'queued') && $updated > 0 && (time() - $updated) > 45)
|
||||||
|
{
|
||||||
|
$data['state'] = 'error';
|
||||||
|
$data['message'] = 'Cache-Aufbau liefert seit mehr als 45 Sekunden keinen Fortschritt. Der Prozess ist vermutlich beendet oder festgefahren.';
|
||||||
|
$data['errors'] = max(1, (int)($data['errors'] ?? 0));
|
||||||
|
}
|
||||||
|
|
||||||
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
|
|||||||
Reference in New Issue
Block a user