1
0
Fork 0

Use deferred tasks

This commit is contained in:
Michael 2022-07-21 06:23:55 +00:00
commit c775833117
4 changed files with 29 additions and 6 deletions

View file

@ -89,8 +89,8 @@ class Cron
Tag::setLocalTrendingHashtags(24, 20);
Tag::setGlobalTrendingHashtags(24, 20);
// Process pending posts in the queue
Queue::processAll();
// Remove old pending posts from the queue
Queue::clear();
// Search for new contacts in the directory
if (DI::config()->get('system', 'synchronize_directory')) {

View file

@ -22,6 +22,7 @@
namespace Friendica\Worker;
use Friendica\Core\Logger;
use Friendica\Core\Worker;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\ActivityPub\Receiver;
@ -35,6 +36,13 @@ class FetchMissingActivity
{
Logger::info('Start fetching missing activity', ['url' => $url]);
$result = ActivityPub\Processor::fetchMissingActivity($url, $child, $relay_actor, $completion);
Logger::info('Finished fetching missing activity', ['url' => $url, 'result' => $result]);
if ($result) {
Logger::info('Successfully fetched missing activity', ['url' => $url]);
} elseif (!Worker::defer()) {
Logger::info('Activity could not be fetched', ['url' => $url]);
// Possibly we should recursively remove child activities at this point.
} else {
Logger::info('Fetching deferred', ['url' => $url]);
}
}
}