From 7faba0de5e3dad58c0782c6331cf88f874862197 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 15 Aug 2023 02:13:50 +0000 Subject: [PATCH] New function for the number of retrials / Daily reload of hooks --- src/Core/Worker.php | 11 +++++++++++ src/Worker/Cron.php | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 00885f6920..7075b4b236 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -1365,6 +1365,17 @@ class Worker return $new_retrial; } + /** + * Get the number of retrials for the current worker task + * + * @return integer + */ + public static function getRetrial(): int + { + $queue = DI::app()->getQueue(); + return $queue['retrial'] ?? 0; + } + /** * Defers the current worker entry * diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 73d158070e..18ede945c5 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -21,6 +21,7 @@ namespace Friendica\Worker; +use Friendica\Core\Addon; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Worker; @@ -146,6 +147,8 @@ class Cron // Update "blocked" status of servers Worker::add(Worker::PRIORITY_LOW, 'UpdateBlockedServers'); + Addon::reload(); + DI::keyValue()->set('last_cron_daily', time()); } -- 2.39.5