@ -132,37 +132,7 @@ function updateShareStats() {
if ( globalMinerList === false ) {
globalMinerList = [ ] ;
}
minerList . forEach ( function ( miner ) {
if ( globalMinerList . indexOf ( miner ) === - 1 ) {
globalMinerList . push ( miner ) ;
}
let cachedData = global . database . getCache ( miner ) ;
if ( cachedData !== false ) {
cachedData . hash = Math . floor ( localStats . miners [ miner ] / 600 ) ;
cachedData . lastHash = localTimes . miners [ miner ] ;
if ( ! cachedData . hasOwnProperty ( "hashHistory" ) ) {
cachedData . hashHistory = [ ] ;
}
if ( cycleCount === 0 ) {
cachedData . hashHistory . unshift ( { ts : currentTime , hs : cachedData . hash } ) ;
if ( cachedData . hashHistory . length > global . config . general . statsBufferLength ) {
while ( cachedData . hashHistory . length > global . config . general . statsBufferLength ) {
cachedData . hashHistory . pop ( ) ;
}
}
}
} else {
cachedData = {
hash : Math . floor ( localStats . miners [ miner ] / 600 ) ,
totalHashes : 0 ,
lastHash : localTimes . miners [ miner ] ,
hashHistory : [ { ts : currentTime , hs : cachedData . hash } ] ,
goodShares : 0 ,
badShares : 0
} ;
}
global . database . setCache ( miner , cachedData ) ;
} ) ;
let globalTimes = [ ] ;
// pplns: 0, pps: 0, solo: 0, prop: 0, global: 0
[ 'pplns' , 'pps' , 'solo' , 'prop' , 'global' ] . forEach ( function ( key ) {
let cachedData = global . database . getCache ( key + "_stats" ) ;
@ -188,6 +158,9 @@ function updateShareStats() {
}
}
}
cachedData . hashHistory . forEach ( function ( data ) {
globalTimes . push ( data . ts ) ;
} ) ;
} else {
cachedData = {
hash : Math . floor ( localStats [ key ] / 600 ) ,
@ -200,6 +173,43 @@ function updateShareStats() {
}
global . database . setCache ( key + "_stats" , cachedData ) ;
} ) ;
minerList . forEach ( function ( miner ) {
if ( globalMinerList . indexOf ( miner ) === - 1 ) {
globalMinerList . push ( miner ) ;
}
let cachedData = global . database . getCache ( miner ) ;
if ( cachedData !== false ) {
cachedData . hash = Math . floor ( localStats . miners [ miner ] / 600 ) ;
cachedData . lastHash = localTimes . miners [ miner ] ;
if ( ! cachedData . hasOwnProperty ( "hashHistory" ) ) {
cachedData . hashHistory = [ ] ;
}
if ( cycleCount === 0 ) {
cachedData . hashHistory . unshift ( { ts : currentTime , hs : cachedData . hash } ) ;
if ( cachedData . hashHistory . length > global . config . general . statsBufferLength ) {
while ( cachedData . hashHistory . length > global . config . general . statsBufferLength ) {
cachedData . hashHistory . pop ( ) ;
}
}
let hashData = cachedData . hashHistory ;
hashData . forEach ( function ( data ) {
if ( ! globalTimes . hasOwnProperty ( data . ts ) ) {
cachedData . hashHistory . splice ( cachedData . hashHistory . indexOf ( data ) , 1 ) ;
}
} ) ;
}
} else {
cachedData = {
hash : Math . floor ( localStats . miners [ miner ] / 600 ) ,
totalHashes : 0 ,
lastHash : localTimes . miners [ miner ] ,
hashHistory : [ { ts : currentTime , hs : cachedData . hash } ] ,
goodShares : 0 ,
badShares : 0
} ;
}
global . database . setCache ( miner , cachedData ) ;
} ) ;
globalMinerList . forEach ( function ( miner ) {
if ( minerList . indexOf ( miner ) === - 1 ) {
let minerStats = global . database . getCache ( miner ) ;