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

resumeOnRestart: Successful jobs never get restarted #54

Open
@christian-schwaderer

Description

@christian-schwaderer

Description

I have some concern regarding the resumeOnRestart option.

Imagine a situation like this:

  • We have a job to run every minute
  • The job successfully runs at 9:00:00
  • nextRunAt is set to 9:01:00
  • lastFinishedAt is set to 9:00:00
  • Now, the server crashes at 9:00:30
  • The Server successfully restarts at 9:01:20
    => Server has missed the run at 9:01:00
    => I expect the job to rerun at 9:02:00

However, if my testing is right, it will never run again because of

{
              lockedAt: { $exists: false },
              lastFinishedAt: { $exists: false },
              nextRunAt: { $lte: now, $ne: null },
            },

in resume-on-restart.ts.
The crucial part is lastFinishedAt: { $exists: false }.
Pulse obviously "thinks": "Oh, this got successfully finished, so we do not have to do anything here".

Code example

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions