]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Worker.php
Merge pull request #8263 from annando/remote-follow
[friendica.git] / src / Core / Worker.php
index da38cba10a116fd639375312e7a06a5774c64010..f41636beda2ac6e82f7a608f1e7d5145031eae11 100644 (file)
@@ -1,7 +1,24 @@
 <?php
 /**
- * @file src/Core/Worker.php
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
+
 namespace Friendica\Core;
 
 use Friendica\Core;
@@ -12,14 +29,8 @@ use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 
 /**
- * @file src/Core/Worker.php
- *
  * Contains the class for the worker background job processing
  */
-
-/**
- * Worker methods
- */
 class Worker
 {
        const STATE_STARTUP    = 1; // Worker is in startup. This takes most time.
@@ -65,7 +76,7 @@ class Worker
                // Kill stale processes every 5 minutes
                $last_cleanup = DI::config()->get('system', 'worker_last_cleaned', 0);
                if (time() > ($last_cleanup + 300)) {
-                       Config::set('system', 'worker_last_cleaned', time());
+                       DI::config()->set('system', 'worker_last_cleaned', time());
                        self::killStaleWorkers();
                }
 
@@ -297,7 +308,7 @@ class Worker
                        $stamp = (float)microtime(true);
                        $condition = ["`id` = ? AND `next_try` < ?", $queue['id'], DateTimeFormat::utcNow()];
                        if (DBA::update('workerqueue', ['done' => true], $condition)) {
-                               Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
+                               DI::config()->set('system', 'last_worker_execution', DateTimeFormat::utcNow());
                        }
                        self::$db_duration = (microtime(true) - $stamp);
                        self::$db_duration_write += (microtime(true) - $stamp);
@@ -343,7 +354,7 @@ class Worker
 
                        $stamp = (float)microtime(true);
                        if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
-                               Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow());
+                               DI::config()->set('system', 'last_worker_execution', DateTimeFormat::utcNow());
                        }
                        self::$db_duration = (microtime(true) - $stamp);
                        self::$db_duration_write += (microtime(true) - $stamp);
@@ -1004,7 +1015,7 @@ class Worker
                                return;
                        }
 
-                       Config::set("system", "worker_started", time());
+                       DI::config()->set("system", "worker_started", time());
 
                        // Do we have enough running workers? Then we quit here.
                        if (self::tooMuchWorkers()) {