Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. onishin
  2.  
  3. var hashratess = result.map(function(item){
  4. var parts = item.split(':');
  5. var time_reg = parseInt(parts[2]);
  6. var time_reduc = Math.round(parts[2] / 1000 ) ;
  7. if ( ( time_reg % 1000 ) != 333 ) {
  8. redis_multi.push(['zrem', config.coin + ':hashrate' , item]);
  9. var v = newhashrate[parts[1]] ;
  10. if (v === undefined) newhashrate[parts[1]] = {};
  11. newhashrate[parts[1]][time_reduc] = ( newhashrate[parts[1]][time_reduc] || 0 ) + parseInt(parts[0]) ;
  12. i++;
  13. }
  14. });
  15.  
  16. log('info', logSystem, 'Continue compresse hash create table for zadd');
  17.  
  18. for ( var addr in newhashrate){
  19. for ( var timeshort in newhashrate[addr] ){
  20. redis_multi.push(['zadd', config.coin + ':hashrate' , ( timeshort ) , [ newhashrate[addr][timeshort] , addr, ( ( timeshort * 1000 ) + 333 ) ].join(':') ]);
  21. };
  22. };
  23.  
  24.  
  25.  
  26. var redisCommands = [
  27. ['hincrby', config.coin + ':shares:roundCurrent', miner.login, job.score],
  28. - ['zadd', config.coin + ':hashrate', dateNowSeconds, [job.difficulty, miner.login, dateNow].join(':')],
  29. ['hincrby', config.coin + ':workers:' + miner.login, 'hashes', job.difficulty],
  30. - ['hset', config.coin + ':workers:' + miner.login, 'lastShare', dateNowSeconds]
  31. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement