]> git.mxchange.org Git - friendica.git/commitdiff
And moving the block back to the old place
authorMichael <heluecht@pirati.ca>
Wed, 27 Feb 2019 07:08:44 +0000 (07:08 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 27 Feb 2019 07:08:44 +0000 (07:08 +0000)
src/Core/Worker.php

index 362d41811cde1def8cef04fb901f62251a4b8af7..1aa33917071d568712289ba16cda06ba3f92e2ae 100644 (file)
@@ -124,13 +124,6 @@ class Worker
                                self::$state = self::STATE_LONG_LOOP;
                        }
 
-                       // Quit the worker once every cron interval
-                       if (time() > ($starttime + Config::get('system', 'cron_interval'))) {
-                               Logger::log('Process lifetime reached, respawning.', Logger::DEBUG);
-                               self::spawnWorker();
-                               return;
-                       }
-
                        // To avoid the quitting of multiple workers only one worker at a time will execute the check
                        if (Lock::acquire('worker', 0)) {
                                // Count active workers and compare them with a maximum value that depends on the load
@@ -148,6 +141,13 @@ class Worker
                                }
                                Lock::release('worker');
                        }
+
+                       // Quit the worker once every cron interval
+                       if (time() > ($starttime + Config::get('system', 'cron_interval'))) {
+                               Logger::log('Process lifetime reached, respawning.', Logger::DEBUG);
+                               self::spawnWorker();
+                               return;
+                       }
                }
 
                // Cleaning up. Possibly not needed, but it doesn't harm anything.