-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pulse re-runs finished jobs after a process restart #57
Comments
We tested it under the same conditions as yours, but it could not be reproduced. |
For what it's worth, I'm seeing similar behavior with the following dependency versions: Pulse version: |
I'm experiencing the same issue. Using pulse 1.6.6, Node 20.18.0, Mongoose 8.8.2.
For example, I have the job below in my database. This job is complete but on every server restart, it gets executed again.
To temporarily deal with the issue, I've added at the top of my job:
|
I wonder if the behavior is coming from using |
I am also instantiating pulse with I assumed using this would work as it did in Agenda, given the docs' assertion that this project is a continuation of Agenda...mostly seems to be the case, with the exception of this bug. |
Having the same issue. Pulse version: 1.6.7 Pulse initialized with: const pulse = new Pulse({
db: {
address: "mongodb://localhost:27017/db",
collection: "jobs",
options: { auth: { /* ... */ } },
},
}); Jobs are created like this: const job = pulse.create("job-name", { /* ... */ });
job.repeatEvery('0 12 * * *', { timezone: "..." });
job.computeNextRunAt();
await job.save(); Restarting application makes all jobs run again. Even if their last run was completed succesfully. The same code worked well in Agenda. Adding |
The code for resumeOnRestart checks for if lockedAt exists. On all my Jobs lockedAt has been set to pulse/src/pulse/resume-on-restart.ts Lines 26 to 28 in d338d77
From my understanding lockedAt should either be a date or not set. But in job run it gets set to null? Line 48 in d338d77
|
Description
I have a Pulse job that's scheduled to run every midnight on week days (
repeatInterval: "0 0 * * 1-5"
). When it's finished, Pulse leaveslockedAt: null
andlastRunAt
with the last run date in the job document (insidepulseJobs
MongoDB collection).Once I restart a Node.js process, Pulse picks up this job again no matter the actual time (the job should run only at midnight). And it happens with every restart, even though the job gets completed, it's not interrupted.
Code example
Pulse client configuration
The job configuration
Pulse debug logs
Additional context
Node.js version:
20.12.2
(also happens on22.x
).MongoDB version:
7.0
.MongoDB Node driver:
6.5.0
.The text was updated successfully, but these errors were encountered: