]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Worker.php
Merge pull request #8044 from annando/contact-adding
[friendica.git] / src / Core / Worker.php
index fc30ce12d5777648fa27c6c4625f23dfbbd308d4..02c8f65cbb6760ca384f25eb276761f7a53f8e39 100644 (file)
@@ -56,7 +56,7 @@ class Worker
                self::$up_start = microtime(true);
 
                // At first check the maximum load. We shouldn't continue with a high load
-               if ($a->isMaxLoadReached()) {
+               if (DI::process()->isMaxLoadReached()) {
                        Logger::log('Pre check: maximum load reached, quitting.', Logger::DEBUG);
                        return;
                }
@@ -78,7 +78,7 @@ class Worker
                }
 
                // Do we have too few memory?
-               if ($a->isMinMemoryReached()) {
+               if (DI::process()->isMinMemoryReached()) {
                        Logger::log('Pre check: Memory limit reached, quitting.', Logger::DEBUG);
                        return;
                }
@@ -90,7 +90,7 @@ class Worker
                }
 
                // Possibly there are too much database processes that block the system
-               if ($a->isMaxProcessesReached()) {
+               if (DI::process()->isMaxProcessesReached()) {
                        Logger::log('Pre check: maximum processes reached, quitting.', Logger::DEBUG);
                        return;
                }
@@ -140,7 +140,7 @@ class Worker
                                        }
 
                                        // Check free memory
-                                       if ($a->isMinMemoryReached()) {
+                                       if (DI::process()->isMinMemoryReached()) {
                                                Logger::log('Memory limit reached, quitting.', Logger::DEBUG);
                                                Lock::release('worker');
                                                return;
@@ -251,8 +251,6 @@ class Worker
         */
        public static function execute($queue)
        {
-               $a = \get_app();
-
                $mypid = getmypid();
 
                // Quit when in maintenance
@@ -262,7 +260,7 @@ class Worker
                }
 
                // Constantly check the number of parallel database processes
-               if ($a->isMaxProcessesReached()) {
+               if (DI::process()->isMaxProcessesReached()) {
                        Logger::log("Max processes reached for process ".$mypid, Logger::DEBUG);
                        return false;
                }
@@ -981,7 +979,7 @@ class Worker
                        return;
                }
 
-               $url = System::baseUrl()."/worker";
+               $url = DI::baseUrl() . '/worker';
                Network::fetchUrl($url, false, 1);
        }
 
@@ -1086,7 +1084,7 @@ class Worker
                $args = ['no_cron' => !$do_cron];
 
                $a = get_app();
-               $process = new Core\Process(DI::logger(), $a->getMode(), DI::config(), $a->getBasePath());
+               $process = new Core\Process(DI::logger(), DI::mode(), DI::config(), $a->getBasePath());
                $process->run($command, $args);
 
                // after spawning we have to remove the flag.
@@ -1129,7 +1127,7 @@ class Worker
 
                $priority = PRIORITY_MEDIUM;
                // Don't fork from frontend tasks by default
-               $dont_fork = Config::get("system", "worker_dont_fork", false) || !\get_app()->getMode()->isBackend();
+               $dont_fork = Config::get("system", "worker_dont_fork", false) || !DI::mode()->isBackend();
                $created = DateTimeFormat::utcNow();
                $force_priority = false;