Merge pull request #9040 from annando/fix-polling
Fix: Feeds and mail accounts hadn't been fetched reliably
This commit is contained in:
commit
9cff999974
|
@ -212,8 +212,6 @@ class Cron
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
private static function pollContacts() {
|
private static function pollContacts() {
|
||||||
$min_poll_interval = DI::config()->get('system', 'min_poll_interval');
|
|
||||||
|
|
||||||
Addon::reload();
|
Addon::reload();
|
||||||
|
|
||||||
$sql = "SELECT `contact`.`id`, `contact`.`nick`, `contact`.`name`, `contact`.`network`, `contact`.`archive`,
|
$sql = "SELECT `contact`.`id`, `contact`.`nick`, `contact`.`name`, `contact`.`network`, `contact`.`archive`,
|
||||||
|
@ -278,12 +276,17 @@ class Cron
|
||||||
/*
|
/*
|
||||||
* Based on $contact['priority'], should we poll this site now? Or later?
|
* Based on $contact['priority'], should we poll this site now? Or later?
|
||||||
*/
|
*/
|
||||||
$t = $contact['last-update'];
|
|
||||||
|
$min_poll_interval = DI::config()->get('system', 'min_poll_interval');
|
||||||
|
|
||||||
$poll_intervals = [$min_poll_interval . ' minute', '15 minute', '30 minute',
|
$poll_intervals = [$min_poll_interval . ' minute', '15 minute', '30 minute',
|
||||||
'1 hour', '2 hour', '3 hour', '6 hour', '12 hour' ,'1 day', '1 week', '1 month'];
|
'1 hour', '2 hour', '3 hour', '6 hour', '12 hour' ,'1 day', '1 week', '1 month'];
|
||||||
|
|
||||||
if (empty($poll_intervals[$rating]) || (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . ' + ' . $poll_intervals[$rating]))) {
|
$now = DateTimeFormat::utcNow();
|
||||||
|
$next_update = DateTimeFormat::utc($contact['last-update'] . ' + ' . $poll_intervals[$rating]);
|
||||||
|
|
||||||
|
if (empty($poll_intervals[$rating]) || ($now < $next_update)) {
|
||||||
|
Logger::debug('No update', ['cid' => $contact['id'], 'rating' => $rating, 'next' => $next_update, 'now' => $now]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -708,6 +708,9 @@ class OnePoll
|
||||||
Logger::log("Mail: no mails for ".$mailconf['user']);
|
Logger::log("Mail: no mails for ".$mailconf['user']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self::updateContact($contact, ['failed' => false, 'last-update' => $updated, 'success_update' => $updated]);
|
||||||
|
Contact::unmarkForArchival($contact);
|
||||||
|
|
||||||
Logger::log("Mail: closing connection for ".$mailconf['user']);
|
Logger::log("Mail: closing connection for ".$mailconf['user']);
|
||||||
imap_close($mbox);
|
imap_close($mbox);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user