Individual defer limits per worker task

This commit is contained in:
Michael 2023-10-29 12:51:26 +00:00
parent a7c985a590
commit 9faad72ec0
4 changed files with 15 additions and 4 deletions

View file

@ -30,6 +30,8 @@ use Friendica\Protocol\ActivityPub\Receiver;
class FetchMissingActivity
{
const WORKER_DEFER_LIMIT = 5;
/**
* Fetch missing activities
* @param string $url Contact URL
@ -42,7 +44,7 @@ class FetchMissingActivity
$result = ActivityPub\Processor::fetchMissingActivity($url, $child, $relay_actor, $completion);
if ($result) {
Logger::info('Successfully fetched missing activity', ['url' => $url]);
} elseif (!Worker::defer()) {
} elseif (!Worker::defer(self::WORKER_DEFER_LIMIT)) {
Logger::info('Activity could not be fetched', ['url' => $url]);
// recursively delete all entries that belong to this worker task