Skip to content
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

Scheduled job runs multiple times #1575

Open
DevanshB10 opened this issue Feb 18, 2024 · 2 comments
Open

Scheduled job runs multiple times #1575

DevanshB10 opened this issue Feb 18, 2024 · 2 comments

Comments

@DevanshB10
Copy link

{
  "_id": {
    "$oid": "65d21a62b0672011458b40f9"
  },
  "name": "a52ea4aa10e4ecc8bfae408d90a74d36665ce7e661d35efe380e2828d43177b9",
  "data": null,
  "priority": 0,
  "shouldSaveResult": false,
  "type": "normal",
  "nextRunAt": null,
  "lastModifiedBy": null,
  "lockedAt": {
    "$date": "2024-02-18T15:15:57.428Z"
  },
  "lastRunAt": {
    "$date": "2024-02-18T15:15:57.546Z"
  }
}

I scheduled this job for a specific time to run once. But this is executing every 10 minutes, even after achieving nextRunAt: null

Can anyone help, why does this happen?

@rkrasto
Copy link

rkrasto commented Mar 7, 2024

How much time does your job take to finish?
I noticed that the 'lockedAt' field is not null, indicating that the job is still running.
By default, the 'lockLifetime' is set to 10 minutes. Therefore, if the job is still executing for more than 10 minutes, it will restart.

@DevanshB10
Copy link
Author

@rkrasto the job takes less than 1 second to complete.
For the time being, I am managing this by deleting the job after it runs once. Is there a better way though?

Another question: agenda.maxConcurrency(50);

What would this translate to? Does this mean atmost 50 jobs can run at the same time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants