12345678910111213141516171819202122232425262728293031 |
- /**
- * 计划任务调度器。
- *
- * https://github.com/node-schedule/node-schedule
- *
- * author: Sand
- * since: 2016/11/28
- */
- "use strict";
- let nodeSchedule = require('node-schedule');
- let log = require("../../util/log.js");
- class Schedule {
- constructor(){
- }
- static cronSchedule(cronExp, handler){
- log.info('Job scheduled by cron express: ' + cronExp);
- return nodeSchedule.scheduleJob(cronExp, handler);
- }
- static dateSchedule(date, handler){
- log.info('Job scheduled at ' + date.toUTCString());
- return nodeSchedule.scheduleJob(date, handler);
- }
- }
- module.exports = Schedule;
|