]> git.mxchange.org Git - friendica.git/commitdiff
Ensure that cron workers are called even at busy times
authorMichael <heluecht@pirati.ca>
Wed, 6 Jun 2018 05:26:22 +0000 (05:26 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 6 Jun 2018 05:26:22 +0000 (05:26 +0000)
bin/daemon.php

index 185e0671a0868fad448c33ec6ec675cc40ed22be..2069c13ea823a8fbce27af06e8365664a0d0abee 100755 (executable)
@@ -127,11 +127,21 @@ file_put_contents($pidfile, $pid);
 $wait_interval = intval(Config::get('system', 'cron_interval', 5)) * 60;
 
 $do_cron = true;
+$last_cron = 0;
 
 // Now running as a daemon.
 while (true) {
+       if (!$do_cron && ($last_cron + $wait_interval) < time()) {
+               logger('Forcing cron worker call.');
+               $do_cron = true;
+       }
+
        Worker::spawnWorker($do_cron);
 
+       if ($do_cron) {
+               $last_cron = time();
+       }
+
        logger("Sleeping", LOGGER_DEBUG);
        $i = 0;
        do {