Open DiscoTim opened 6 years ago
Hi looking at this function, a few things:
function collectUsersHashrate(chartName, settings) { var redisBaseKey = getStatsRedisKey(chartName) + ':'; redisClient.keys(redisBaseKey + '*', function(keys) { var hashrates = {}; for(var i in keys) { hashrates[keys[i].substr(keys[i].length)] = 0; } getUsersHashrates(function(newHashrates) { for(var address in newHashrates) { hashrates[address] = newHashrates[address]; } storeCollectedValues(chartName, hashrates, settings); }); }); }
I think...
redisClient.keys(redisBaseKey + '*', function(keys) {
should be:
redisClient.keys(redisBaseKey + '*', function(err, keys) {
The way it is 'keys' will be the error and null, and the for loop does not execute.
This line:
hashrates[keys[i].substr(keys[i].length)] = 0;
the statement
keys[i].substr(keys[i].length) will always equal ""
keys[i].substr(keys[i].length)
I think it was intended to be:
hashrates[keys[i].substr(redisBaseKey.length)] = 0
in order to write a hashrate of 0 to all inactive miners, however i am not sure if that is even necessary.
Hi looking at this function, a few things:
I think...
redisClient.keys(redisBaseKey + '*', function(keys) {
should be:
redisClient.keys(redisBaseKey + '*', function(err, keys) {
The way it is 'keys' will be the error and null, and the for loop does not execute.
This line:
hashrates[keys[i].substr(keys[i].length)] = 0;
the statement
keys[i].substr(keys[i].length)
will always equal ""I think it was intended to be:
hashrates[keys[i].substr(redisBaseKey.length)] = 0
in order to write a hashrate of 0 to all inactive miners, however i am not sure if that is even necessary.