Small update to send all work to be done up to the Master thread. This should help deal with the fact that shares must be sent by one of the nodes that handles data.

This commit is contained in:
Alexander Blair
2017-07-01 20:38:16 -07:00
parent c492925dc9
commit df94faab9b
2 changed files with 9 additions and 7 deletions
+5
View File
@@ -90,6 +90,11 @@ function messageHandler(message) {
minerCount[message.data] += 1; minerCount[message.data] += 1;
} }
break; break;
case 'sendRemote':
if (cluster.isMaster) {
global.database.sendQueue.push(Buffer.from(message.data, 'hex'));
}
break;
} }
} }
+4 -7
View File
@@ -20,7 +20,7 @@ function Database() {
function () { function () {
callback(); callback();
}); });
}, 32); }, 128);
this.storeShare = function (blockId, shareData) { this.storeShare = function (blockId, shareData) {
let wsData = global.protos.WSData.encode({ let wsData = global.protos.WSData.encode({
@@ -29,8 +29,7 @@ function Database() {
msg: shareData, msg: shareData,
exInt: blockId exInt: blockId
}); });
this.sendQueue.push({body: wsData}, function () { process.send({type: 'sendRemote', body: wsData.toString('hex')});
});
}; };
this.storeBlock = function (blockId, blockData) { this.storeBlock = function (blockId, blockData) {
@@ -40,8 +39,7 @@ function Database() {
msg: blockData, msg: blockData,
exInt: blockId exInt: blockId
}); });
this.sendQueue.push({body: wsData}, function () { process.send({type: 'sendRemote', body: wsData.toString('hex')});
});
}; };
this.storeInvalidShare = function (minerData) { this.storeInvalidShare = function (minerData) {
@@ -51,8 +49,7 @@ function Database() {
msg: minerData, msg: minerData,
exInt: 1 exInt: 1
}); });
this.sendQueue.push({body: wsData}, function () { process.send({type: 'sendRemote', body: wsData.toString('hex')});
});
}; };
this.initEnv = function(){ this.initEnv = function(){