Initialisation code on jobs

Issue #14 wontfix
Iván Loire created an issue

Be able to define onStart actions for jobs (for initialisation code, cron, etc).

Ex: instead of:

module.exports = function(config, dependencies, job_callback) {     
    job_callback(null, {});
};

have something like this:

module.exports = {
  onStart: function (config, dependencies, job_callback){
    //this is executed once 
  },
  onRun: function(config, dependencies, job_callback){
    //this is executed every job interval  
  }
}

Comments (2)

  1. Iván Loire reporter

    and eventually:

    module.exports = {
      dependencies: {
         "cron" : "0.0.x"
      },
      onStart: ....
    }
    
  2. Iván Loire reporter

    We can specify dependencies now in a per package package.json and we can execute code only once by setting a flag in the job, so we can close this issue

  3. Log in to comment