This commit is contained in:
chaosBreaking
2019-09-29 09:45:19 +08:00
parent 5021a22daa
commit a1be616abc
4 changed files with 4 additions and 7 deletions

View File

@@ -20,4 +20,4 @@ const run = tasks => {
});
};
run([dbConnect, startJob,runServer]);
run([dbConnect, startJob, runServer]);

View File

@@ -14,6 +14,7 @@
"dependencies": {
"@alicloud/sms-sdk": "^1.1.6",
"agenda": "^2.0.2",
"agendash": "^1.0.0",
"axios": "^0.19.0",
"bignumber": "^1.1.0",
"bitcore-mnemonic": "^8.6.0",

View File

@@ -18,4 +18,5 @@ module.exports = () => inject(async function startJob(SysConfig) {
mountJobs(Job);
await Job.start();
mylog.info('任务队列启动...');
return Job;
});

View File

@@ -76,11 +76,6 @@ const jobs = [
name: 'mine',
processor: async (job, done) => {
//todo: 程序内检查是否可以执行,保证不会启动时错误的自动执行一次
const now = new Date();
if (now.getHours() !== 23 && now.getMinutes() < 58) {
mylog.error('[Schedule Job] 不在合理时间启动...程序结束');
return done();
}
mylog.info('[Schedule Job] 开始定时计算作业...');
let currentIndex = await system.findOne({
key: 'userIndex4job'
@@ -106,7 +101,7 @@ const jobs = [
job.touch();
}
mylog.info('收益计算分配完成');
done();
done('收益计算分配完成');
},
type: 'every',
slot: '0 0 3 * * *',