Small corrections

This commit is contained in:
Michael 2017-06-13 20:51:24 +00:00
parent 5183de8075
commit a056afd566
2 changed files with 11 additions and 7 deletions

View file

@ -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() {