From 8ea572ebd19083f474a698336af880c84a1380e8 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 8 Feb 2018 13:09:09 +0000 Subject: [PATCH] Added a config value to ignore server checks --- doc/htconfig.md | 1 + src/Worker/Queue.php | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/doc/htconfig.md b/doc/htconfig.md index e09c37b74..3a482742d 100644 --- a/doc/htconfig.md +++ b/doc/htconfig.md @@ -69,6 +69,7 @@ Example: To set the automatic database cleanup process add this line to your .ht * **ostatus_poll_timeframe** - Defines how old an item can be to try to complete the conversation with it. * **paranoia** (Boolean) - Log out users if their IP address changed. * **permit_crawling** (Boolean) - Restricts the search for not logged in users to one search per minute. +* **queue_no_dead_check** (Boolean) - Ignore if the target contact or server seems to be dead during queue delivery. * **worker_debug** (Boolean) - If enabled, it prints out the number of running processes split by priority. * **worker_fetch_limit** - Number of worker tasks that are fetched in a single query. Default is 1. * **profiler** (Boolean) - Enable internal timings to help optimize code. Needed for "rendertime" addon. Default is false. diff --git a/src/Worker/Queue.php b/src/Worker/Queue.php index f44be4918..d92be19fe 100644 --- a/src/Worker/Queue.php +++ b/src/Worker/Queue.php @@ -6,6 +6,7 @@ namespace Friendica\Worker; use Friendica\Core\Addon; use Friendica\Core\Cache; +use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBM; use Friendica\Model\Queue as QueueModel; @@ -28,6 +29,8 @@ class Queue $cachekey_deadguy = 'queue_run:deadguy:'; $cachekey_server = 'queue_run:server:'; + $no_dead_check = Config::get('system', 'queue_no_dead_check', false); + if (!$queue_id) { logger('queue: start'); @@ -80,28 +83,30 @@ class Queue $dead = Cache::get($cachekey_deadguy . $contact['notify']); - if (!is_null($dead) && $dead) { + if (!is_null($dead) && $dead && !$no_dead_check) { logger('queue: skipping known dead url: ' . $contact['notify']); QueueModel::updateTime($q_item['id']); return; } - $server = PortableContact::detectServer($contact['url']); + if (!$no_dead_check) { + $server = PortableContact::detectServer($contact['url']); - if ($server != "") { - $vital = Cache::get($cachekey_server . $server); + if ($server != "") { + $vital = Cache::get($cachekey_server . $server); - if (is_null($vital)) { - logger("Check server " . $server . " (" . $contact["network"] . ")"); + if (is_null($vital)) { + logger("Check server " . $server . " (" . $contact["network"] . ")"); - $vital = PortableContact::checkServer($server, $contact["network"], true); - Cache::set($cachekey_server . $server, $vital, CACHE_QUARTER_HOUR); - } + $vital = PortableContact::checkServer($server, $contact["network"], true); + Cache::set($cachekey_server . $server, $vital, CACHE_QUARTER_HOUR); + } - if (!is_null($vital) && !$vital) { - logger('queue: skipping dead server: ' . $server); - QueueModel::updateTime($q_item['id']); - return; + if (!is_null($vital) && !$vital) { + logger('queue: skipping dead server: ' . $server); + QueueModel::updateTime($q_item['id']); + return; + } } }