1.0.2 • Published 4 years ago

egg-init-schedule v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

egg-init-schedule

NPM version build status Test coverage David deps Known Vulnerabilities npm download

eggjs 启动或者重启的时候,读取 MongoDB 数据库查找出未完成的定时任务,重新建立定时任务

Install

$ npm i egg-init-schedule --save

Usage

// {app_root}/config/plugin.js
exports.initSchedule = {
  enable: true,
  package: 'egg-init-schedule',
};

Configuration

// {app_root}/config/config.default.js
exports.initSchedule = {
  time: 'messageTime', // 建立定时器的字段名
  model: 'Message', // 数据库表名
  // app 启动时候查询 mongodb 的查询参数
  params: {
    status: 0,
  },
  // 定时任务执行之后,更新 mongodb 数据的参数
  update: {
    status: 1,
  },
};

see config/config.default.js for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT