Skip to content

Commit

Permalink
fix: don't start job in setTime if it wasn't running
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerlox authored and intcreator committed Apr 22, 2023
1 parent 4322ef2 commit 7e26c23
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/job.js
Expand Up @@ -88,9 +88,10 @@ function CronJob(CronTime, spawn) {
// crontime is an object...
throw new Error('time must be an instance of CronTime.');
}
const wasRunning = this.running;
this.stop();
this.cronTime = time;
this.start();
if (wasRunning) this.start();
};

CJ.prototype.nextDate = function () {
Expand Down

0 comments on commit 7e26c23

Please sign in to comment.