[FIX] Whoopsie
This commit is contained in:
parent
a78141b5ce
commit
ca0634929e
@ -622,15 +622,15 @@ class Statistics extends Base {
|
||||
**/
|
||||
public function getWorkerHashrate($worker_id, $interval=180) {
|
||||
$this->debug->append("STA " . __METHOD__, 4);
|
||||
if ($data = $this->memcache->get(__FUNCTION__ . $username)) return $data;
|
||||
if ($data = $this->memcache->get(__FUNCTION__ . $worker_id)) return $data;
|
||||
$stmt = $this->mysqli->prepare("
|
||||
SELECT IFNULL(ROUND(SUM(IF(difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * POW(2, " . $this->config['target_bits'] . ") / 600 / 1000), 0) AS hashrate
|
||||
FROM " . $this->share->getTableName() . " AS
|
||||
WHERE username = '?'
|
||||
AND our_result = 'Y'
|
||||
AND time > DATE_SUB(now(), INTERVAL ? SECOND));
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $username, $interval) && $stmt->execute() && $result = $stmt->get_result() )
|
||||
return $this->memcache->setCache(__FUNCTION__ . $username, $result->fetch_object()->hashrate);
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $worker_id, $interval) && $stmt->execute() && $result = $stmt->get_result() )
|
||||
return $this->memcache->setCache(__FUNCTION__ . $worker_id, $result->fetch_object()->hashrate);
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user