fix: job
This commit is contained in:
2
index.js
2
index.js
@@ -20,4 +20,4 @@ const run = tasks => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
run([dbConnect, startJob,runServer]);
|
run([dbConnect, startJob, runServer]);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alicloud/sms-sdk": "^1.1.6",
|
"@alicloud/sms-sdk": "^1.1.6",
|
||||||
"agenda": "^2.0.2",
|
"agenda": "^2.0.2",
|
||||||
|
"agendash": "^1.0.0",
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
"bignumber": "^1.1.0",
|
"bignumber": "^1.1.0",
|
||||||
"bitcore-mnemonic": "^8.6.0",
|
"bitcore-mnemonic": "^8.6.0",
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ module.exports = () => inject(async function startJob(SysConfig) {
|
|||||||
mountJobs(Job);
|
mountJobs(Job);
|
||||||
await Job.start();
|
await Job.start();
|
||||||
mylog.info('任务队列启动...');
|
mylog.info('任务队列启动...');
|
||||||
|
return Job;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,11 +76,6 @@ const jobs = [
|
|||||||
name: 'mine',
|
name: 'mine',
|
||||||
processor: async (job, done) => {
|
processor: async (job, done) => {
|
||||||
//todo: 程序内检查是否可以执行,保证不会启动时错误的自动执行一次
|
//todo: 程序内检查是否可以执行,保证不会启动时错误的自动执行一次
|
||||||
const now = new Date();
|
|
||||||
if (now.getHours() !== 23 && now.getMinutes() < 58) {
|
|
||||||
mylog.error('[Schedule Job] 不在合理时间启动...程序结束');
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
mylog.info('[Schedule Job] 开始定时计算作业...');
|
mylog.info('[Schedule Job] 开始定时计算作业...');
|
||||||
let currentIndex = await system.findOne({
|
let currentIndex = await system.findOne({
|
||||||
key: 'userIndex4job'
|
key: 'userIndex4job'
|
||||||
@@ -106,7 +101,7 @@ const jobs = [
|
|||||||
job.touch();
|
job.touch();
|
||||||
}
|
}
|
||||||
mylog.info('收益计算分配完成');
|
mylog.info('收益计算分配完成');
|
||||||
done();
|
done('收益计算分配完成');
|
||||||
},
|
},
|
||||||
type: 'every',
|
type: 'every',
|
||||||
slot: '0 0 3 * * *',
|
slot: '0 0 3 * * *',
|
||||||
|
|||||||
Reference in New Issue
Block a user