From 0e6b27c9f46141c3ca92fc8dddc51d866cf5f3c9 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 17 Nov 2022 11:50:13 +0000 Subject: if a feed fails, do not update connected timestamp. attempt to poll feeds only once a day if we could not fetch it last time we tried --- Zotlabs/Daemon/Onepoll.php | 13 +++++++++++-- Zotlabs/Daemon/Poller.php | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php index f2b5d8c58..0a30a0c7d 100644 --- a/Zotlabs/Daemon/Onepoll.php +++ b/Zotlabs/Daemon/Onepoll.php @@ -64,12 +64,21 @@ class Onepoll { if ($contact['xchan_network'] === 'rss') { logger('onepoll: processing feed ' . $contact['xchan_name'], LOGGER_DEBUG); $alive = handle_feed($importer['channel_id'], $contact_id, $contact['xchan_hash']); - if ($alive) { - q("update abook set abook_connected = '%s' where abook_id = %d", + + if (!$alive) { + q("update abook set abook_updated = '%s' where abook_id = %d", dbesc(datetime_convert()), intval($contact['abook_id']) ); + return; } + + q("update abook set abook_updated = '%s', abook_connected = '%s' where abook_id = %d", + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($contact['abook_id']) + ); + return; } diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php index 88213a7c9..702c940a3 100644 --- a/Zotlabs/Daemon/Poller.php +++ b/Zotlabs/Daemon/Poller.php @@ -93,7 +93,14 @@ class Poller { $min = intval(get_config('system', 'minimum_feedcheck_minutes')); if (!$min) $min = 60; + + if ($t !== $c) { + // if the last fetch failed only attempt fetch once a day + $min = 60 * 24; + } + $x = datetime_convert('UTC', 'UTC', "now - $min minutes"); + if ($c < $x) { Master::Summon(['Onepoll', $contact['abook_id']]); if ($interval) -- cgit v1.2.3