From 8a2d541139e3c78fb92730fc673eabe90ff6906f Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Sat, 15 Aug 2026 19:19:21 +0200 Subject: [PATCH] Detect stalled manual cache builds in status endpoint --- main-cache-status.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main-cache-status.php b/main-cache-status.php index ad391f5..60a7ab5 100644 --- a/main-cache-status.php +++ b/main-cache-status.php @@ -44,4 +44,13 @@ if (!is_array($data)) 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);