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

How to prevent two different events from running in parallel #790

Open
larsblumberg opened this issue Jul 31, 2024 · 3 comments
Open

How to prevent two different events from running in parallel #790

larsblumberg opened this issue Jul 31, 2024 · 3 comments

Comments

@larsblumberg
Copy link

Summary

Two jobs each of a different event are executed at the same time.

While it's possible to not run 2 jobs of the same event in parallel, I guess that's not yet configurable globally for all events?

Steps to reproduce the problem

  1. Schedule 2 different, long running events, at a similar time
  2. Watch the 2nd job starting although the first has not yet finished

Your Setup

Regular setup

Operating system and version?

Debian docker image

Node.js version?

v20.16.0 (LTS)

Cronicle software version?

0.9.56

Are you using a multi-server setup, or just a single server?

Single server

@jhuckaby
Copy link
Owner

jhuckaby commented Aug 1, 2024

I'm not entirely sure what you want to achieve -- like, what is your end goal:

(1) If you want to ensure that your jobs ALWAYS run exactly in sequence, one at a time, then use the Chain Reaction feature. Schedule one event to run at the desired start time, set the second event to "On Demand" (no specific time), then "chain" the first event to the second one:

Screenshot 2024-07-31 at 8 19 41 PM

(2) If you want to ensure that only one of your two jobs runs at any given time, and trigger an error if another one attempts to run while the other is running, assign both events to the same category, then edit the category (on the Admin tab) and set the Max Concurrent jobs to 1:

Screenshot 2024-07-31 at 8 18 44 PM

Hope this helps.

@larsblumberg
Copy link
Author

Hi @jhuckaby , thanks for your guidance. I was actually looking for a queue per category. So that if a second scheduled event tries to run in a category, that job would wait until the previous job in the same category is done. Both are scheduled events and I want to prevent both run at the same time. It would be okay if the 2nd event which is scheduled to run after the first event would just wait for the 1st one to finish.

For now it's okay to error out the 2nd event. It's a workaround at least. Thanks again!

@jhuckaby
Copy link
Owner

jhuckaby commented Aug 2, 2024

Ah, apologies, there is no queue per category. They are only per event.

Glad you were able to find a workaround tho!

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