X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fdaemon.php;h=c7a16a9e8d5b0952f732160ec1e63ad977ba291a;hb=121e40357ce215a464ff44a1e76dc73bee2d940c;hp=ec507305cc826d621ba73cb5972082cab728595d;hpb=9a6141dcbeb8c0334356d7e92060748906fd6e46;p=friendica.git diff --git a/bin/daemon.php b/bin/daemon.php index ec507305cc..c7a16a9e8d 100755 --- a/bin/daemon.php +++ b/bin/daemon.php @@ -1,7 +1,7 @@ #!/usr/bin/env php addRules(include __DIR__ . '/../static/dependencies.config $dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['daemon']]); DI::init($dice); +\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class)); $a = DI::app(); if (DI::mode()->isInstall()) { @@ -195,7 +196,7 @@ while (true) { $do_cron = true; } - if ($do_cron || (!DI::process()->isMaxLoadReached() && Worker::entriesExists() && Worker::isReady())) { + if ($do_cron || (!DI::system()->isMaxLoadReached() && Worker::entriesExists() && Worker::isReady())) { Worker::spawnWorker($do_cron); } else { Logger::info('Cool down for 5 seconds', ['pid' => $pid]); @@ -223,6 +224,11 @@ while (true) { $sleep = min(1000000, round(log10($arg) * 1000000, 0)); usleep($sleep); + $pid = pcntl_waitpid(-1, $status, WNOHANG); + if ($pid > 0) { + Logger::info('Children quit via pcntl_waitpid', ['pid' => $pid, 'status' => $status]); + } + $timeout = ($seconds >= $wait_interval); } while (!$timeout && !Worker::IPCJobsExists());