timer.js 545 Bytes
Newer Older
wuhao's avatar
wuhao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
const Job = require('ee-core/jobs/baseJobClass');
const Log = require('ee-core/log');
const Ps = require('ee-core/ps');

/**
 * example - TimerJob
 * @class
 */
class TimerJob extends Job {

  constructor(params) {
    super();
    this.params = params;
  }

  /**
   * handle()方法是必要的,且会被自动调用
   */
  async handle () {
    Log.info("[child-process] TimerJob params: ", this.params);

wuhao's avatar
wuhao committed
22 23 24
    if (Ps.isChildJob()) {
      Ps.exit();
    }
wuhao's avatar
wuhao committed
25 26 27 28 29
  }   
}

TimerJob.toString = () => '[class TimerJob]';
module.exports = TimerJob;