#!/usr/bin/env php
<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
$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()) {
$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]);
usleep($sleep);
$pid = pcntl_waitpid(-1, $status, WNOHANG);
- Logger::info('Checked children status via pcntl_waitpid', ['pid' => $pid, 'status' => $status]);
-
+ if ($pid > 0) {
+ Logger::info('Children quit via pcntl_waitpid', ['pid' => $pid, 'status' => $status]);
+ }
+
$timeout = ($seconds >= $wait_interval);
} while (!$timeout && !Worker::IPCJobsExists());