diff --git a/package.json b/package.json index 3a3c917..4430855 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hokify/agenda", - "version": "4.0.19", + "version": "4.0.20", "description": "Light weight job scheduler for Node.js", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/JobProcessor.ts b/src/JobProcessor.ts index 5a73af1..621e89d 100644 --- a/src/JobProcessor.ts +++ b/src/JobProcessor.ts @@ -451,6 +451,11 @@ export class JobProcessor { ); return; } + // when job is not running anymore, just finish + if (!job.isRunning()) { + resolve(); + return; + } resolve(checkIfJobIsDead()); }, this.processEvery) );