X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fdaemon.php;h=d08aa37d15906fab61ceaf63a67707f26b0d0c24;hb=974f7bffc82d024a38b4709c6b250677a217f65a;hp=3fe803d6fc772eaaf5f105a128630b36dc3e6047;hpb=c6b45a958e3b09bc8f3950a718c181dfc9e0b910;p=friendica.git diff --git a/bin/daemon.php b/bin/daemon.php index 3fe803d6fc..d08aa37d15 100755 --- a/bin/daemon.php +++ b/bin/daemon.php @@ -33,6 +33,7 @@ use Friendica\Core\Logger; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Util\DateTimeFormat; use Psr\Log\LoggerInterface; // Get options @@ -193,8 +194,8 @@ while (true) { if ($do_cron || (!DI::process()->isMaxLoadReached() && Worker::entriesExists() && Worker::isReady())) { Worker::spawnWorker($do_cron); } else { - Logger::info('Cool down', ['pid' => $pid]); - sleep(10); + Logger::info('Cool down for 5 seconds', ['pid' => $pid]); + sleep(5); } if ($do_cron) { @@ -205,8 +206,9 @@ while (true) { $last_cron = time(); } - Logger::info("Sleeping", ["pid" => $pid]); $start = time(); + Logger::info("Sleeping", ["pid" => $pid, 'until' => gmdate(DateTimeFormat::MYSQL, $start + $wait_interval)]); + do { $seconds = (time() - $start); @@ -214,7 +216,7 @@ while (true) { // Background: After jobs had been started, they often fork many workers. // To not waste too much time, the sleep period increases. $arg = (($seconds + 1) / ($wait_interval / 9)) + 1; - $sleep = round(log10($arg) * 1000000, 0); + $sleep = min(1000000, round(log10($arg) * 1000000, 0)); usleep($sleep); $timeout = ($seconds >= $wait_interval);