maxBuffer

This commit is contained in:
chaosBreaking
2019-10-19 18:18:16 +08:00
parent 166b0b5551
commit 8d643660fb
2 changed files with 31 additions and 23 deletions

View File

@@ -5,7 +5,6 @@ const path = require('path');
const fs = require('fs');
const prettyStdOut = new PrettyStream();
prettyStdOut.pipe(process.stdout);
if (!fs.existsSync('minelog')) {
fs.mkdirSync('minelog');
@@ -163,17 +162,14 @@ async function mine (job = mock, done = mock) {
value: -1
}
});
typeof process.send === 'function' && process.send('tick');
}
currentIndex += 10;
probe.currentIndex = currentIndex;
}
mylog.info('收益计算分配完成');
typeof process.send === 'function' && process.send('tick');
await system.findOneAndUpdate({
key: 'userIndex4job'
}, { $set: { value: 0 } }).exec();
typeof process.send === 'function' && process.send('tick');
await system.findOneAndUpdate({
key: 'mineCount',
}, {
@@ -181,20 +177,18 @@ async function mine (job = mock, done = mock) {
value: 1
}
}, { upsert: true });
typeof process.send === 'function' && process.send('tick');
await system.findOneAndUpdate({
key: 'lastMine',
}, {
value: new Date().toISOString()
}, { upsert: true });
typeof process.send === 'function' && process.send('tick');
typeof done === 'function' && done('收益计算分配完成');
process.exit();
}
const probe = {
currentIndex: 0
};
const start = async () => {
const start = async (job, done) => {
const SysConfig = require('../../configSec');
mongoose.set('useCreateIndex', true);
const { DB_USER_NAME, DB_PASSWD, DB_HOST, DB_PORT, DB_NAME } = SysConfig;
@@ -219,6 +213,9 @@ const start = async () => {
process.on('SIGINT', beforeExit);
process.on('uncaughtException', beforeExit);
process.on('unhandledRejection', beforeExit);
mine();
typeof process.send === 'function' && process.send('子进程开始执行mine');
mine(job, done);
typeof process.send === 'function' && process.send('子进程mine执行完毕');
};
start();