]> git.mxchange.org Git - friendica.git/commitdiff
Use cache instead of config for storing last proc_run time
authorMichael <heluecht@pirati.ca>
Sun, 22 Jan 2017 05:20:14 +0000 (05:20 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 22 Jan 2017 05:20:14 +0000 (05:20 +0000)
boot.php

index 501ae38c429f7d79978c14408422c762e7b18e24..ef787c63530ce1c9d304ffd814bedf70ba12fe22 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1391,11 +1391,15 @@ class App {
                        // If the last worker fork was less than 10 seconds before then don't fork another one.
                        // This should prevent the forking of masses of workers.
                        if (get_config("system", "worker")) {
-                               if ((time() - get_config("system", "proc_run_started")) < 10)
-                                       return;
-
+                               $cachekey = "app:proc_run:started";
+                               $result = Cache::get($cachekey);
+                               if (!is_null($result)) {
+                                       if ((time() - $result) < 10) {
+                                               return;
+                                       }
+                               }
                                // Set the timestamp of the last proc_run
-                               set_config("system", "proc_run_started", time());
+                               Cache::set($cachekey, time(), CACHE_MINUTE);
                        }
 
                        $args[0] = ((x($this->config,'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php');