mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
Update remoteShare.js
This commit is contained in:
+9
-7
@@ -71,16 +71,18 @@ app.post('/leafApi', function (req, res) {
|
||||
}
|
||||
});
|
||||
|
||||
function storeShares(){
|
||||
if (Object.keys(shareData).length > 0){
|
||||
global.database.storeBulkShares(shareData);
|
||||
shareData = [];
|
||||
}
|
||||
setTimeout(storeShares, 1000);
|
||||
}
|
||||
|
||||
if (cluster.isMaster) {
|
||||
let numWorkers = require('os').cpus().length;
|
||||
console.log('Master cluster setting up ' + numWorkers + ' workers...');
|
||||
|
||||
setInterval(function(){
|
||||
if (Object.keys(shareData).length > 0){
|
||||
global.database.storeBulkShares(shareData);
|
||||
shareData = [];
|
||||
}
|
||||
}, 1000);
|
||||
storeShares();
|
||||
|
||||
for (let i = 0; i < numWorkers; i++) {
|
||||
let worker = cluster.fork();
|
||||
|
||||
Reference in New Issue
Block a user