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.

Scheduled jobs gets skipped on the startup of new (additional) pulse instance #71

@het-delwadiya

Description

@het-delwadiya

Description

I have scheduled jobs that gets executed by multiple containers. When I trigger a deployment, It creates new containers. At startup of new container, somehow it updates lastRunAt date and nextRunAt date without running the queued recurring jobs (jobs with nextRunAt passed current date). lockedAt will be still null and lastFinishedAt date doesn't get updated. I was able to reproduce it on my local by having 20-25 recurring jobs queued and starting an instance. Btw I have a job that runs after every 10 seconds and prints the number of jobs that are in queue. That number gets reduced very quickly without actually running jobs.

Node version - 18.12.1.
Pulse version - 1.5.1

Pulse options -

new Pulse({ mongo: mongoose.connection.db, defaultLockLifetime: 20 * 60 * 60 * 1000, // 20 hours resumeOnRestart: false, db: { address: null, collection: "agendaJobs" } })

Example job document -

{ "_id": { "$oid": "6788ee553fad7cfdfd8e084d" }, "name": "API_SYNC", "data": { "somedata": "jobdata" }, "priority": 0, "shouldSaveResult": false, "attempts": 0, "backoff": null, "type": "normal", "nextRunAt": { "$date": "2025-01-16T11:52:00.000Z" }, "lastModifiedBy": null, "lockedAt": null, "lastRunAt": { "$date": "2025-01-16T11:51:38.497Z" }, "finishedCount": 7, "lastFinishedAt": { "$date": "2025-01-16T11:46:29.935Z" }, "runCount": 7, "disabled": false, "endDate": null, "repeatInterval": "*/2 * * * *", "repeatTimezone": "America/New_York", "skipDays": null, "startDate": { "$date": "2025-01-16T00:30:00.000Z" } }

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