From f2862598a9fe40e92ff3ba16095207e8a0869770 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 23 Mar 2014 14:18:54 -0600 Subject: [PATCH] Slightly faster hashrate adding without using math.random --- libs/shareProcessor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/shareProcessor.js b/libs/shareProcessor.js index b28ac20..1022858 100644 --- a/libs/shareProcessor.js +++ b/libs/shareProcessor.js @@ -60,7 +60,8 @@ module.exports = function(logger, poolConfig){ /* Stores share diff, worker, and unique value with a score that is the timestamp. Unique value ensures it doesn't overwrite an existing entry, and timestamp as score lets us query shares from last X minutes to generate hashrate for each worker and pool. */ - redisCommands.push(['zadd', coin + '_hashrate', Date.now() / 1000 | 0, [shareData.difficulty, shareData.worker, Math.random()].join(':')]); + var dateNow = Date.now(); + redisCommands.push(['zadd', coin + '_hashrate', dateNow / 1000 | 0, [shareData.difficulty, shareData.worker, dateNow].join(':')]); } else{ redisCommands.push(['hincrby', coin + '_stats', 'invalidShares', 1]);