]> git.mxchange.org Git - friendica.git/commitdiff
Fastlane is now working with any priority level
authorMichael Vogel <icarus@dabo.de>
Wed, 3 Aug 2016 13:59:25 +0000 (15:59 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 3 Aug 2016 13:59:25 +0000 (15:59 +0200)
boot.php
include/items.php
include/poller.php

index 7aa33e5662a6754295a9c33e6db4620c14f87748..1beba74a07c07a0172768c46282a30cdb3bdac08 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2278,7 +2278,7 @@ function current_load() {
        if (!is_array($load_arr))
                return false;
 
-       return max($load_arr);
+       return max($load_arr[0], $load_arr[1]);
 }
 
 /**
index 754d5b0882a121a84fec75d0a03642d922aaf8e0..6d2c830f96ba8cf4a2c9ea63e59e1313371a7915 100644 (file)
@@ -1712,7 +1712,7 @@ function item_expire($uid, $days, $network = "", $force = false) {
        } else
                $range = "AND `created` < UTC_TIMESTAMP() - INTERVAL %d DAY ";
 
-       $r = q("SELECT * FROM `item`
+       $r = q("SELECT `file`, `resource-id`, `starred`, `type`, `id` FROM `item`
                WHERE `uid` = %d $range
                AND `id` = `parent`
                $sql_extra
index 6dce81e717cf617b9d1a8922aa4390fed8ae35a4..dfc3b90cf08c4249df88095cfc65b67663e2ca4f 100644 (file)
@@ -270,25 +270,24 @@ function poller_too_much_workers() {
                $slope = $maxworkers / pow($maxsysload, $exponent);
                $queues = ceil($slope * pow(max(0, $maxsysload - $load), $exponent));
 
-               if (Config::get("system", "worker_fastlane", false) AND ($queues > 0) AND ($active >= $queues)) {
-                       $s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `priority` = %d AND `executed` = '0000-00-00 00:00:00'",
-                               intval(PRIORITY_HIGH));
-                       $high_waiting = $s[0]["total"];
+               $s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00'");
+               $entries = $s[0]["total"];
+
+               if (Config::get("system", "worker_fastlane", false) AND ($queues > 0) AND ($entries > 0) AND ($active >= $queues)) {
+                       $s = q("SELECT `priority` FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `priority` LIMIT 1");
+                       $top_priority = $s[0]["priority"];
 
-                       $s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `priority` = %d AND `executed` != '0000-00-00 00:00:00'",
-                               intval(PRIORITY_HIGH));
+                       $s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `priority` <= %d AND `executed` != '0000-00-00 00:00:00'",
+                               intval($top_priority));
                        $high_running = $s[0]["total"];
 
                        /// @todo define maximum number of fastlanes
-                       if (($high_waiting > 0) AND ($high_running == 0)) {
-                               logger("There are ".$high_waiting." high priority jobs waiting but none is executed. Open a fastlane.", LOGGER_DEBUG);
+                       if (($high_running == 0) AND ($top_priority >= PRIORITY_HIGH) AND ($top_priority < PRIORITY_LOW)) {
+                               logger("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", LOGGER_DEBUG);
                                $queues = $active + 1;
                        }
                }
 
-               $s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00'");
-               $entries = $s[0]["total"];
-
                logger("Current load: ".$load." - maximum: ".$maxsysload." - current queues: ".$active."/".$entries." - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
 
                // Are there fewer workers running as possible? Then fork a new one.