From be633abe0218c894d64c4d64f252eaddafdbf468 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 15 Jul 2024 05:28:45 +0000 Subject: [PATCH] Process unprocessed queue entries in a separate worker process --- src/Worker/Cron.php | 3 +- src/Worker/ProcessUnprocessedEntries.php | 40 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/Worker/ProcessUnprocessedEntries.php diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 24cb9544f2..d2f8d07918 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -28,7 +28,6 @@ use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Tag; -use Friendica\Protocol\ActivityPub\Queue; use Friendica\Protocol\Relay; use Friendica\Util\DateTimeFormat; @@ -93,7 +92,7 @@ class Cron Tag::setGlobalTrendingHashtags(24, 20); // Process all unprocessed entries - Queue::processAll(); + Worker::add(Worker::PRIORITY_LOW, 'ProcessUnprocessedEntries'); // Search for new contacts in the directory if (DI::config()->get('system', 'synchronize_directory')) { diff --git a/src/Worker/ProcessUnprocessedEntries.php b/src/Worker/ProcessUnprocessedEntries.php new file mode 100644 index 0000000000..fdfd168974 --- /dev/null +++ b/src/Worker/ProcessUnprocessedEntries.php @@ -0,0 +1,40 @@ +. + * + */ + +namespace Friendica\Worker; + +use Friendica\Core\Logger; +use Friendica\Protocol\ActivityPub\Queue; + +class ProcessUnprocessedEntries +{ + /** + * Process all unprocessed entries + * + * @return void + */ + public static function execute() + { + Logger::info('Start processing unprocessed entries'); + Queue::processAll(); + Logger::info('Successfully processed unprocessed entries'); + } +}