From c20795d1083bc0acd41c01b73d893645da98156d Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Thu, 3 Sep 2026 23:14:41 +0200 Subject: [PATCH] Treat connector deferrals as waiting instead of cache errors --- main-cache-status.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/main-cache-status.php b/main-cache-status.php index 9f06ed4..4cb0bc7 100644 --- a/main-cache-status.php +++ b/main-cache-status.php @@ -40,7 +40,7 @@ function bratonien_tools_status_webdav_label(array $status) $state = (string)($status['state'] ?? 'idle'); $prefix = $connection > 0 ? 'WebDAV #'.$connection.': ' : 'WebDAV: '; - if ($state === 'queued') return $prefix.((string)($status['message'] ?? '') !== '' ? (string)$status['message'] : 'Worker wartet auf den Start.'); + if ($state === 'queued' || $state === 'waiting') return $prefix.((string)($status['message'] ?? '') !== '' ? (string)$status['message'] : 'Worker wartet auf den nächsten sicheren Startpunkt.'); if ($state === 'scan') { $sources = (int)($status['shadow_sources'] ?? 0); @@ -95,6 +95,7 @@ usort($webdav, function($a, $b) { }); $webdav_active = false; +$webdav_waiting = false; $webdav_cancelling = false; $webdav_cancelled = false; $webdav_error = false; @@ -133,7 +134,7 @@ foreach ($webdav as &$status) $webdav_progress_total += $selected * 2; $webdav_progress_completed += $stage >= 2 ? $selected + $stage_completed : $stage_completed; } - elseif (in_array($state, array('complete','error','fatal','preempted','cancelled'), true)) + elseif (in_array($state, array('complete','error','fatal','preempted','cancelled','waiting'), true)) { $selected = max(0, (int)($status['selected'] ?? 0)); if ($selected > 0) @@ -149,6 +150,7 @@ foreach ($webdav as &$status) } if (in_array($state, array('queued','scan','running'), true)) $webdav_active = true; + if ($state === 'waiting') $webdav_waiting = true; if ($state === 'cancelling') $webdav_cancelling = true; if ($state === 'cancelled') $webdav_cancelled = true; if ($state === 'preempted') $webdav_pending = true; @@ -161,7 +163,7 @@ unset($status); $local_state = (string)($local['state'] ?? 'idle'); $local_updated = (int)($local['updated_at'] ?? 0); $local_stale = in_array($local_state, array('running','queued'), true) && $local_updated > 0 && (time() - $local_updated) > 45; -if ($local_stale && !$webdav_active && !$webdav_cancelling) +if ($local_stale && !$webdav_active && !$webdav_cancelling && !$webdav_waiting) { $local['state'] = 'error'; $local['message'] = 'Der lokale Piwigo-Teil liefert seit mehr als 45 Sekunden keinen Fortschritt.'; @@ -205,6 +207,14 @@ elseif ($webdav_active) $overall['message'] = 'Gesamtaufbau läuft'.($webdav_source_total > 0 ? ' · '.$webdav_source_total.' WebDAV-Quellen' : '').'. '.$local_label; $overall['current'] = implode(' ', $webdav_lines); } +elseif ($webdav_waiting) +{ + $overall['state'] = 'queued'; + $overall['total'] = $combined_total; + $overall['completed'] = $combined_completed; + $overall['message'] = 'Cache-Aufbau pausiert für laufende Connector-Synchronisierung'.($webdav_source_total > 0 ? ' · '.$webdav_source_total.' WebDAV-Quellen' : '').'. Der Indexstand bleibt erhalten.'; + $overall['current'] = implode(' ', $webdav_lines); +} elseif ($webdav_error || $local_state === 'error') { $overall['state'] = 'error';