]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Worker.php
Use "maxloadavg" when "worker_load_cooldown" is not defined
[friendica.git] / src / Core / Worker.php
index 036f065d421368677f8608f61034a8df413a0776..a57792ce7cee881d92ebf75c60a8882ae491c3d2 100644 (file)
@@ -31,6 +31,13 @@ use Friendica\Util\DateTimeFormat;
  */
 class Worker
 {
+       const PRIORITY_UNDEFINED  = PRIORITY_UNDEFINED;
+       const PRIORITY_CRITICAL   = PRIORITY_CRITICAL;
+       const PRIORITY_HIGH       = PRIORITY_HIGH;
+       const PRIORITY_MEDIUM     = PRIORITY_MEDIUM;
+       const PRIORITY_LOW        = PRIORITY_LOW;
+       const PRIORITY_NEGLIGIBLE = PRIORITY_NEGLIGIBLE;
+
        const STATE_STARTUP    = 1; // Worker is in startup. This takes most time.
        const STATE_LONG_LOOP  = 2; // Worker is processing the whole - long - loop.
        const STATE_REFETCH    = 3; // Worker had refetched jobs in the execution loop.
@@ -454,6 +461,10 @@ class Worker
                $load_cooldown      = DI::config()->get('system', 'worker_load_cooldown');
                $processes_cooldown = DI::config()->get('system', 'worker_processes_cooldown');
 
+               if ($load_cooldown == 0) {
+                       $load_cooldown = DI::config()->get('system', 'maxloadavg');
+               }
+
                if (($load_cooldown == 0) && ($processes_cooldown == 0)) {
                        return false;
                }
@@ -494,6 +505,10 @@ class Worker
                $load_cooldown      = DI::config()->get('system', 'worker_load_cooldown');
                $processes_cooldown = DI::config()->get('system', 'worker_processes_cooldown');
 
+               if ($load_cooldown == 0) {
+                       $load_cooldown = DI::config()->get('system', 'maxloadavg');
+               }
+
                if (($load_cooldown == 0) && ($processes_cooldown == 0)) {
                        return;
                }