Skip to content

Commit

Permalink
fix: add check for nextRunAt on non-recurrent jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
b0dea committed Nov 19, 2024
1 parent 97ee2d5 commit f80b330
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/pulse/resume-on-restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export const resumeOnRestart: ResumeOnRestartMethod = function (this: Pulse, res
$or: [
{
lockedAt: { $exists: true },
nextRunAt: { $ne: null },
$or: [
{ nextRunAt: { $lte: now, $ne: null } },
{ nextRunAt: { $exists: false } },
{ nextRunAt: null },
],
$or: [
{ $expr: { $eq: ['$runCount', '$finishedCount'] } },
{ $or: [{ lastFinishedAt: { $exists: false } }, { lastFinishedAt: null }] },
Expand All @@ -40,7 +44,11 @@ export const resumeOnRestart: ResumeOnRestartMethod = function (this: Pulse, res
{
lockedAt: { $exists: false },
$or: [{ lastFinishedAt: { $exists: false } }, { lastFinishedAt: null }],
nextRunAt: { $lte: now, $ne: null },
$or: [
{ nextRunAt: { $lte: now, $ne: null } },
{ nextRunAt: { $exists: false } },
{ nextRunAt: null },
],
},
],
},
Expand Down

0 comments on commit f80b330

Please sign in to comment.