|
|
@ -931,6 +931,7 @@ const workers = [];
|
|
|
|
for (let i = 0; i < numCPUs; i++) {
|
|
|
|
for (let i = 0; i < numCPUs; i++) {
|
|
|
|
workers.push(fork('lib/check-signature.js'));
|
|
|
|
workers.push(fork('lib/check-signature.js'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var nextWorker = 0;
|
|
|
|
var initWorker = function (worker) {
|
|
|
|
var initWorker = function (worker) {
|
|
|
|
worker.on('message', function (res) {
|
|
|
|
worker.on('message', function (res) {
|
|
|
|
onChecked.fire(res);
|
|
|
|
onChecked.fire(res);
|
|
|
@ -1018,12 +1019,12 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) {
|
|
|
|
|
|
|
|
|
|
|
|
console.log(+new Date(), "Send verification request");
|
|
|
|
console.log(+new Date(), "Send verification request");
|
|
|
|
// Send the request
|
|
|
|
// Send the request
|
|
|
|
const random = Math.floor(Math.random() * 4);
|
|
|
|
workers[nextWorker].send({
|
|
|
|
workers[random].send({
|
|
|
|
|
|
|
|
txid: txid,
|
|
|
|
txid: txid,
|
|
|
|
msg: signedMsg,
|
|
|
|
msg: signedMsg,
|
|
|
|
key: metadata.validateKey
|
|
|
|
key: metadata.validateKey
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (++nextWorker > numCPUs) { nextWorker = 0; }
|
|
|
|
}).nThen(function () {
|
|
|
|
}).nThen(function () {
|
|
|
|
// do checkpoint stuff...
|
|
|
|
// do checkpoint stuff...
|
|
|
|
|
|
|
|
|
|
|
|