From 1f7f1634c4029966ec025b772652a7fe83283dd6 Mon Sep 17 00:00:00 2001 From: Nikos Stouras Date: Tue, 13 Oct 2026 14:31:45 +0300 Subject: [PATCH] Retry feed list load instead of idling forever sync_upload.php loads the local and remote feed list once at startup. If the remote server cannot be reached at that moment, e.g. when the service starts at boot before the network is up, the script continues with an empty feed list and logs "Nothing to upload" indefinitely. Since it never exits, systemd's Restart=always does not help, and syncing silently stops until the user presses sync in the UI. Exit when the initial load fails so that the service manager restarts the script. When a reload fails, keep the previous feed list and the reload flag so that the reload is retried, instead of replacing the feed list with the error response. Signed-off-by: Nikos Stouras --- sync_upload.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sync_upload.php b/sync_upload.php index f95ae5d..b5080e4 100644 --- a/sync_upload.php +++ b/sync_upload.php @@ -45,7 +45,9 @@ $feeds = $sync->get_feed_list($userid); if ((isset($feeds['success']) && $feeds['success']==false) || !is_array($feeds)) { print "Error: could not load feeds\n"; - $feeds = array(); + // Exit rather than run with an empty feed list, which would never + // upload anything; the service manager restarts the script + exit(1); } // ------------------------------------------------ @@ -92,7 +94,14 @@ $upload_size = $r->upload_size; } - $feeds = $sync->get_feed_list($userid); + $result = $sync->get_feed_list($userid); + if ((isset($result['success']) && $result['success']==false) || !is_array($result)) { + // Keep the reload flag set so that the reload is retried + print "Error: could not reload feeds, retrying in 60s\n"; + sleep(60); + continue; + } + $feeds = $result; $remote_id_map = array(); foreach ($feeds as $tagname=>$f) {