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

Avoid a cron job running concurrently with itself #197

Closed
wants to merge 2 commits into from
Closed

Conversation

smlx
Copy link
Member

@smlx smlx commented May 10, 2021

If the time taken for the cronjob to run is longer than the period between jobs you can end up with dozens of cronjob processes running inside the pod.

Since we already wrap the cron command, just add some locking to it so that only one instance of a cron job can run at once.

Closes: #172
Closes: uselagoon/lagoon#2399

If the time taken for the cronjob to run is longer than the period
between jobs you can end up with dozens of cronjob processes running
inside the pod.

Since we already wrap the cron command, just add some locking to it so
that only one instance of a cron job can run at once.
@smlx smlx added the enhancement New feature or request label May 10, 2021
@smlx smlx requested a review from tobybellwood May 10, 2021 13:07
@smlx
Copy link
Member Author

smlx commented May 10, 2021

Not sure if this change is tested in CI. Is this issue still valid? uselagoon/lagoon#2462

@tobybellwood
Copy link
Member

digging into this, lagoon/cronjob.sh is only called for kubernetes-initiated cronjobs, which always run in their own pod, and rely on k8s to remove concurrency, so this flock won't apply to them.

In-pod cronjobs are controlled by the entrypoint at 90-cronjobs.sh running go-crond, so maybe that's where the flock needs inserting?

@smlx
Copy link
Member Author

smlx commented Mar 7, 2023

Ah of course! Thanks for pointing that out. This PR doesn't make sense, so I'll close it.

@smlx smlx closed this Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants