Skip to content

Commit

Permalink
fix: check if lockedAt has been resetted in the meantime
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed May 23, 2022
1 parent 8e3b827 commit aa5323b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/JobProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,15 @@ export class JobProcessor {
return;
}

if (!job.attrs.lockedAt) {
reject(
new Error(
`execution of '${job.attrs.name}' canceled, no lockedAt date found. Ensure to call touch() for long running jobs to keep them alive.`
)
);
return;
}

resolve(checkIfJobIsStillAlive());
}, Math.max(this.processEvery / 2, this.agenda.definitions[job.attrs.name].lockLifetime / 2));
});
Expand Down

0 comments on commit aa5323b

Please sign in to comment.