pulsecron / pulse

The modern MongoDB-powered job scheduler library for Node.js
https://pulsecron.com
MIT License
111 stars 11 forks source link

Updating to v1.6.2 makes all previous jobs enqueued #50

Closed litsynp closed 3 months ago

litsynp commented 3 months ago

Description

Hi. We recently migrated from Agenda to pulse. Projects that migrated to pulse v1.6.1 seem to work fine without issues, but installing v1.6.2 seems to make nextRunAt of all jobs to be set to be now(), which makes the Pulse to lock and restart all our previously completed jobs to start all over again.

Setting resumeOnRestart: true would prevent this though.

Code example

No response

Additional context

No response

code-xhyun commented 3 months ago

@litsynp We apologize. We have just become aware of this issue and are working on resolving it. We will address it promptly.

code-xhyun commented 3 months ago

@litsynp Could you provide us with a sample of the data that should not be executed?

litsynp commented 3 months ago

@code-xhyun Thank you for the quick response. Here's a sample data.

{
  "_id": {
    "$oid": "66bf05cad0633e28dcd2fb4a"
  },
  "name": "SOME_TASK_NAME",
  "data": { "items": [1, 2, 3] },
  "priority": 0,
  "shouldSaveResult": false,
  "type": "normal",
  "nextRunAt": null,
  "lastModifiedBy": null,
  "lockedAt": null,
  "lastRunAt": {
    "$date": "2023-05-23T02:40:17.839Z"
  },
  "result": { "items": [2, 3, 4] },
  "lastFinishedAt": {
    "$date": "2023-05-23T03:16:33.810Z"
  }
}

The dates lastFinishedAt and lastRunAt should mean the job has already been completed, but Pulse would set like nextRunAt: { "$date": "2024-08-16T03:04:55.969Z" }, making the job to restart.

Related is https://github.com/pulsecron/pulse/issues/49.

code-xhyun commented 3 months ago

@litsynp A version that we believe has solved this issue has been deployed (v 1.6.3). Please check it out.

npm package (@latest dist-tag) GitHub release

litsynp commented 3 months ago

@code-xhyun After the 1.6.3 update, I checked that it's going well without any issues. Thank you for your quick process.