Merge pull request #5998 from annando/ap-queue

Unsuccessful ActivitiyPub transmission are now deferred
This commit is contained in:
Tobias Diekershoff 2018-10-23 06:54:11 +02:00 committed by GitHub
commit dbe49a0c1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 14 deletions

View file

@ -243,7 +243,9 @@ class Worker
self::execFunction($queue, $include, $argv, true);
$stamp = (float)microtime(true);
if (DBA::update('workerqueue', ['done' => true], ['id' => $queue['id']])) {
$condition = ["`id` = ? AND `next_try` < ?", $queue['id'], DateTimeFormat::utcNow()];
if (DBA::update('workerqueue', ['done' => true], $condition)) {
Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
}
self::$db_duration = (microtime(true) - $stamp);
@ -1137,8 +1139,8 @@ class Worker
$id = $queue['id'];
if ($retrial > 14) {
logger('Id ' . $id . ' had been tried 14 times, it will be deleted now.', LOGGER_DEBUG);
DBA::delete('workerqueue', ['id' => $id]);
logger('Id ' . $id . ' had been tried 14 times. We stop now.', LOGGER_DEBUG);
return;
}
// Calculate the delay until the next trial