From cbf39f7905b2c24c20be35789a2fd93bfbff2326 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 7 Aug 2013 09:27:50 +0200 Subject: [PATCH] Fix IDLE worker detection * Also mark as IDLE if no valid shares were received Fixes #561 --- public/include/classes/worker.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php index a049f8ea..88999e1c 100644 --- a/public/include/classes/worker.class.php +++ b/public/include/classes/worker.class.php @@ -75,14 +75,15 @@ class Worker { $this->debug->append("STA " . __METHOD__, 4); $stmt = $this->mysqli->prepare(" SELECT account_id, id, username - FROM " . $this->table . " - WHERE monitor = 1 AND ( SELECT SIGN(COUNT(id)) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) = 0"); - + FROM " . $this->table . " AS w + WHERE monitor = 1 + AND ( + SELECT IFNULL(SIGN(IF(our_result = 'Y', COUNT(id), 0)), 0) FROM " . $this->share->getTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE) + ) = 0"); if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); // Catchall $this->setErrorMessage("Unable to fetch IDLE, monitored workers"); - echo $this->mysqli->error; return false; }