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

Check before jobstart, if Job is already running in the cluster #7

Closed
christianfinckler1212 opened this issue Jun 2, 2016 · 2 comments

Comments

@christianfinckler1212
Copy link
Contributor

Currently we trigger the job execution with the cron scheduling mechanism of spring.
But then all servers in the cluster start the same job at the same time.

It would be better if edison-jobs checks before starting the job, if the job is already running in the cluster. That could be done by asking the database for any running job of the same type.

We use the mongo-jobs plugin, too. Here the best solution would be to create a unique index which assures, that only one running job of a type can exists. If the creating of the job fails, you know, the job has already started on a different server in the cluster.

In the code I found the following todo, which might be connected to this issue:
JobService:101: // TODO: use some kind of database lock so we can prevent race conditions

@mazzeb
Copy link
Member

mazzeb commented Sep 12, 2016

I think this issue is solved already.

@gsteinacker
Copy link
Member

Should work... if not, please provide a test

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

3 participants