src/models/cron.js
function(crontab) {
    let _config = this[$EXTRA];
    
    _config.logger.info(`Setting up cron schedule ${crontab}`);

    _config.job = new CronJob({
      cronTime: crontab,
      onTick: _.bind(co.wrap(this._cronCallback), this),
      start: true,
    });

    /* calculate and save time between runs */
    
    // we add 1 second to next date otherwise, _getNextDateFrom() returns 
    // the same date back
    let nextRunDate = _config.job.nextDate().add(1, 'seconds');

    _config.timeBetweenRunsMs = 
      _config.job.cronTime._getNextDateFrom(nextRunDate).valueOf() - nextRunDate.valueOf();
  }
function(crontab) {
    let _config = this[$EXTRA];
    
    _config.logger.info(`Setting up cron schedule ${crontab}`);

    _config.job = new CronJob({
      cronTime: crontab,
      onTick: _.bind(co.wrap(this._cronCallback), this),
      start: true,
    });

    /* calculate and save time between runs */
    
    // we add 1 second to next date otherwise, _getNextDateFrom() returns 
    // the same date back
    let nextRunDate = _config.job.nextDate().add(1, 'seconds');

    _config.timeBetweenRunsMs = 
      _config.job.cronTime._getNextDateFrom(nextRunDate).valueOf() - nextRunDate.valueOf();
  }
function ( crontab ) { let _config = this [ $EXTRA ] ; _config . logger . info ( ` ${ crontab } ` ) ; _config . job = new CronJob ( { cronTime : crontab , onTick : _ . bind ( co . wrap ( this . _cronCallback ) , this ) , start : true , } ) ; /* calculate and save time between runs */ // we add 1 second to next date otherwise, _getNextDateFrom() returns  // the same date back let nextRunDate = _config . job . nextDate ( ) . add ( 1 , 'seconds' ) ; _config . timeBetweenRunsMs = _config . job . cronTime . _getNextDateFrom ( nextRunDate ) . valueOf ( ) - nextRunDate . valueOf ( ) ; }
Start the cron scheduler for this job.
Start the cron scheduler for this job .