Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.

Commit f80b330

Browse files
author
b0dea
committed
fix: add check for nextRunAt on non-recurrent jobs
1 parent 97ee2d5 commit f80b330

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/pulse/resume-on-restart.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ export const resumeOnRestart: ResumeOnRestartMethod = function (this: Pulse, res
3131
$or: [
3232
{
3333
lockedAt: { $exists: true },
34-
nextRunAt: { $ne: null },
34+
$or: [
35+
{ nextRunAt: { $lte: now, $ne: null } },
36+
{ nextRunAt: { $exists: false } },
37+
{ nextRunAt: null },
38+
],
3539
$or: [
3640
{ $expr: { $eq: ['$runCount', '$finishedCount'] } },
3741
{ $or: [{ lastFinishedAt: { $exists: false } }, { lastFinishedAt: null }] },
@@ -40,7 +44,11 @@ export const resumeOnRestart: ResumeOnRestartMethod = function (this: Pulse, res
4044
{
4145
lockedAt: { $exists: false },
4246
$or: [{ lastFinishedAt: { $exists: false } }, { lastFinishedAt: null }],
43-
nextRunAt: { $lte: now, $ne: null },
47+
$or: [
48+
{ nextRunAt: { $lte: now, $ne: null } },
49+
{ nextRunAt: { $exists: false } },
50+
{ nextRunAt: null },
51+
],
4452
},
4553
],
4654
},

0 commit comments

Comments
 (0)