From d5c1ce490b8fb0cd5abfad4db3655016954217d5 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 4 Mar 2016 22:38:18 +0100 Subject: [PATCH] No processing if error or empty array Signed-off-by: Roland Haeder --- include/poller.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/poller.php b/include/poller.php index 90e94ede9e..755862eb6b 100644 --- a/include/poller.php +++ b/include/poller.php @@ -205,6 +205,12 @@ function poller_max_connections_reached() { */ function poller_kill_stale_workers() { $r = q("SELECT `pid`, `executed` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'"); + + if (!is_array($r) || count($r) == 0) { + // No processing here needed + return; + } + foreach($r AS $pid) if (!posix_kill($pid["pid"], 0)) q("UPDATE `workerqueue` SET `executed` = '0000-00-00 00:00:00', `pid` = 0 WHERE `pid` = %d",