Bugfix: In the daemon mode we forgot to call the cron jobs
This commit is contained in:
parent
4cd730ea16
commit
1304dae0d3
|
@ -126,16 +126,25 @@ file_put_contents($pidfile, $pid);
|
||||||
|
|
||||||
$wait_interval = intval(Config::get('system', 'cron_interval', 5)) * 60;
|
$wait_interval = intval(Config::get('system', 'cron_interval', 5)) * 60;
|
||||||
|
|
||||||
|
$do_cron = true;
|
||||||
|
|
||||||
// Now running as a daemon.
|
// Now running as a daemon.
|
||||||
while (true) {
|
while (true) {
|
||||||
logger('Call the worker', LOGGER_DEBUG);
|
Worker::spawnWorker($do_cron);
|
||||||
Worker::spawnWorker();
|
|
||||||
|
|
||||||
logger("Sleep for $wait_interval seconds - or when a worker needs to be called", LOGGER_DEBUG);
|
logger("Sleeping", LOGGER_DEBUG);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
do {
|
do {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
} while (($i++ < $wait_interval) && !Worker::IPCJobsExists());
|
} while (($i++ < $wait_interval) && !Worker::IPCJobsExists());
|
||||||
|
|
||||||
|
if ($i >= $wait_interval) {
|
||||||
|
$do_cron = true;
|
||||||
|
logger("Woke up after $wait_interval seconds.", LOGGER_DEBUG);
|
||||||
|
} else {
|
||||||
|
$do_cron = false;
|
||||||
|
logger("Worker jobs are calling to be forked.", LOGGER_DEBUG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdown() {
|
function shutdown() {
|
||||||
|
|
|
@ -1015,9 +1015,14 @@ class Worker
|
||||||
* @brief Spawns a new worker
|
* @brief Spawns a new worker
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function spawnWorker()
|
public static function spawnWorker($do_cron = false)
|
||||||
{
|
{
|
||||||
$args = ["bin/worker.php", "no_cron"];
|
$args = ["bin/worker.php"];
|
||||||
|
|
||||||
|
if (!$do_cron) {
|
||||||
|
$args[] = "no_cron";
|
||||||
|
}
|
||||||
|
|
||||||
get_app()->proc_run($args);
|
get_app()->proc_run($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue