From a056afd566e796c9d45204a908416549f6c58d63 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 13 Jun 2017 20:51:24 +0000 Subject: [PATCH] Small corrections --- doc/htconfig.md | 2 +- include/poller.php | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/htconfig.md b/doc/htconfig.md index ec961c200f..ed2c816dea 100644 --- a/doc/htconfig.md +++ b/doc/htconfig.md @@ -68,7 +68,7 @@ Example: To set the directory value please add this line to your .htconfig.php: * **ostatus_poll_timeframe** - Defines how old an item can be to try to complete the conversation with it. * **paranoia** (Boolean) - Log out users if their IP address changed. * **permit_crawling** (Boolean) - Restricts the search for not logged in users to one search per minute. -* **worker_debug** (Boolean) - If activated, it prints out the number of running processes split by priority. +* **worker_debug** (Boolean) - If enabled, it prints out the number of running processes split by priority. * **profiler** (Boolean) - Enable internal timings to help optimize code. Needed for "rendertime" addon. Default is false. * **free_crawls** - Number of "free" searches when "permit_crawling" is activated (Default value is 10) * **crawl_permit_period** - Period in seconds between allowed searches when the number of free searches is reached and "permit_crawling" is activated (Default value is 60) diff --git a/include/poller.php b/include/poller.php index 4801ea8fdf..6c2f9a0d6f 100644 --- a/include/poller.php +++ b/include/poller.php @@ -130,7 +130,11 @@ function poller_run($argv, $argc){ */ function poller_total_entries() { $s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` <= '%s'", dbesc(NULL_DATE)); - return $s[0]["total"]; + if (dbm::is_result($s)) { + return $s[0]["total"]; + } else { + return 0; + } } /** @@ -140,7 +144,11 @@ function poller_total_entries() { */ function poller_highest_priority() { $s = q("SELECT `priority` FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority` LIMIT 1", dbesc(NULL_DATE)); - return $s[0]["priority"]; + if (dbm::is_result($s)) { + return $s[0]["priority"]; + } else { + return 0; + } } /** @@ -459,10 +467,6 @@ function poller_kill_stale_workers() { /** * @brief Checks if the number of active workers exceeds the given limits * - * @param integer $entries The number of not executed entries in the worker queue - * @param integer $top_priority The highest not executed priority in the worker queue - * @param boolean $high_running Is a process with priority "$top_priority" running? - * * @return bool Are there too much workers running? */ function poller_too_much_workers() {