]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
OpportunisticQM matches against _system_ max_execution_time
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 11 Jan 2016 12:35:29 +0000 (13:35 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 11 Jan 2016 12:35:29 +0000 (13:35 +0100)
Probably never runs if max_execution_time is 0. I'll handle that later.

plugins/OpportunisticQM/lib/opportunisticqueuemanager.php

index 5c5ce4c20366238baf7b1d10357a9d426d3f6386..c10873e99567f91ad8448aec397d95c382afe5c9 100644 (file)
@@ -18,7 +18,7 @@ class OpportunisticQueueManager extends DBQueueManager
 {
     protected $qmkey = false;
     protected $max_execution_time = null;
-    protected $max_execution_margin = null; // margin to execution time, including timeouts etc.
+    protected $max_execution_margin = null; // margin to PHP's max_execution_time
     protected $max_queue_items = null;
 
     protected $started_at = null;
@@ -45,7 +45,7 @@ class OpportunisticQueueManager extends DBQueueManager
         }
 
         if ($this->max_execution_margin === null) {
-            $this->max_execution_margin = 10;    // should be calculated from our default timeouts for http requests etc.
+            $this->max_execution_margin = 10;   // think PHP's max exec time, minus this value to have time for timeouts etc.
         }
 
         return parent::__construct();
@@ -67,7 +67,7 @@ class OpportunisticQueueManager extends DBQueueManager
             return false;
         }
         // If too much time has passed, stop
-        if ($time_passed >= $this->max_execution_time - $this->max_execution_margin) {
+        if ($time_passed >= $this->max_execution_time || $time_passed > ini_get('max_execution_time') - $this->max_execution_margin) {
             return false;
         }
         // If we have a max-item-limit, check if it has been passed