Added a config value to ignore server checks

This commit is contained in:
Michael 2018-02-08 13:09:09 +00:00
parent 0093f863fd
commit 8ea572ebd1
2 changed files with 19 additions and 13 deletions

View File

@ -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. * **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. * **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. * **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_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. * **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. * **profiler** (Boolean) - Enable internal timings to help optimize code. Needed for "rendertime" addon. Default is false.

View File

@ -6,6 +6,7 @@ namespace Friendica\Worker;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Queue as QueueModel; use Friendica\Model\Queue as QueueModel;
@ -28,6 +29,8 @@ class Queue
$cachekey_deadguy = 'queue_run:deadguy:'; $cachekey_deadguy = 'queue_run:deadguy:';
$cachekey_server = 'queue_run:server:'; $cachekey_server = 'queue_run:server:';
$no_dead_check = Config::get('system', 'queue_no_dead_check', false);
if (!$queue_id) { if (!$queue_id) {
logger('queue: start'); logger('queue: start');
@ -80,28 +83,30 @@ class Queue
$dead = Cache::get($cachekey_deadguy . $contact['notify']); $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']); logger('queue: skipping known dead url: ' . $contact['notify']);
QueueModel::updateTime($q_item['id']); QueueModel::updateTime($q_item['id']);
return; return;
} }
$server = PortableContact::detectServer($contact['url']); if (!$no_dead_check) {
$server = PortableContact::detectServer($contact['url']);
if ($server != "") { if ($server != "") {
$vital = Cache::get($cachekey_server . $server); $vital = Cache::get($cachekey_server . $server);
if (is_null($vital)) { if (is_null($vital)) {
logger("Check server " . $server . " (" . $contact["network"] . ")"); logger("Check server " . $server . " (" . $contact["network"] . ")");
$vital = PortableContact::checkServer($server, $contact["network"], true); $vital = PortableContact::checkServer($server, $contact["network"], true);
Cache::set($cachekey_server . $server, $vital, CACHE_QUARTER_HOUR); Cache::set($cachekey_server . $server, $vital, CACHE_QUARTER_HOUR);
} }
if (!is_null($vital) && !$vital) { if (!is_null($vital) && !$vital) {
logger('queue: skipping dead server: ' . $server); logger('queue: skipping dead server: ' . $server);
QueueModel::updateTime($q_item['id']); QueueModel::updateTime($q_item['id']);
return; return;
}
} }
} }