You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
707 B
28 lines
707 B
2 years ago
|
const moment = require('moment')
|
||
|
// let TEST = false
|
||
|
TEST = true
|
||
|
|
||
|
module.exports = async function (app, task) {
|
||
|
|
||
|
let job = null
|
||
|
try {
|
||
|
job = app.fs.scheduleInit(
|
||
|
{
|
||
|
interval: task.cron,
|
||
|
immediate: TEST,
|
||
|
proRun: !TEST,
|
||
|
},
|
||
|
async () => {
|
||
|
try {
|
||
|
console.log(task.taskName, moment().format('YYYY-MM-DD HH:mm:ss'));
|
||
|
} catch (error) {
|
||
|
app.fs.logger.error(`sechedule: taskJobs, error: ${error}`)
|
||
|
}
|
||
|
});
|
||
|
|
||
|
} catch (error) {
|
||
|
app.fs.logger.error(`sechedule: taskJobs, error: ${error}`);
|
||
|
}
|
||
|
|
||
|
return job;
|
||
|
}
|