From: Michael Date: Mon, 5 Jun 2017 22:41:33 +0000 (+0000) Subject: We found the handbrake ... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2b04865cdbb7c7516b188f786af739d1011b4cbb;p=friendica.git We found the handbrake ... --- diff --git a/include/poller.php b/include/poller.php index 2cf1a15f6b..4bd1ee9e4a 100644 --- a/include/poller.php +++ b/include/poller.php @@ -89,21 +89,16 @@ function poller_run($argv, $argc){ continue; } - // To avoid the quitting of multiple pollers we serialize the next check - if (!Lock::set('poller_worker')) { - logger('Cannot get a lock, retrying.', LOGGER_DEBUG); - poller_unclaim_process(); - continue; - } - - // Count active workers and compare them with a maximum value that depends on the load - if (poller_too_much_workers()) { - logger('Active worker limit reached, quitting.', LOGGER_DEBUG); - return; + // To avoid the quitting of multiple pollers only one poller at a time will execute the check + if (Lock::set('poller_worker', 0)) { + // Count active workers and compare them with a maximum value that depends on the load + if (poller_too_much_workers()) { + logger('Active worker limit reached, quitting.', LOGGER_DEBUG); + return; + } + Lock::remove('poller_worker'); } - Lock::remove('poller_worker'); - // Check free memory if ($a->min_memory_reached()) { logger('Memory limit reached, quitting.', LOGGER_DEBUG); diff --git a/src/Util/Lock.php b/src/Util/Lock.php index 7cc3472e69..63f9b5f973 100644 --- a/src/Util/Lock.php +++ b/src/Util/Lock.php @@ -79,7 +79,7 @@ class Lock { if (!$got_lock) { usleep($wait_sec * 1000000); } - } while (!$got_lock AND ((time(true) - $start) < $timeout)); + } while (!$got_lock AND ((time() - $start) < $timeout)); return $got_lock; }