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

#129 ensure running jobs are not abandoned in cluster env #130

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

JesKingDev
Copy link
Contributor

@JesKingDev JesKingDev commented Feb 8, 2023

tl;dr Fixes #129 and improves on the recent consumer job changes. Also improves dev ex for the stub file. Handles SIGTERM.

Service Exit

If the service has been requested to exit (cron disabled, new cluster leader takes over, SIGTERM etc.), the service would simply exit. In environments like Kubernetes, where the cron service is monitored, this could cause the container to be stopped abruptly, killing any running jobs. This change adds a handleExit() method, which first waits for the running jobs to finish before shutting down.

Better consumer handling

In the most recent release, an improvement was made to only run consumer jobs if there are messages in the queue. However, the jobs would then be marked as missed once messages were available. This change updates the job correctly and adds a message indicating that no messages were waiting to be processed.

Developer Experience

Added formatting of the stub file with whitespace stripping. This makes the functionality of the stub easier to understand and work with, and should also help with tracking changes to that file in the future.

Logging

Updated echo to use the existing. print method / logging pattern.

Jessica King added 6 commits February 8, 2023 12:08
- ensure jobs aren’t abandoned if cron engine shuts down
- Better consumer handling
   - If queue is empty, instead of the job appearing as ‘missed’, update the status and message to indicate that it was skipped due to no messages.
- correct log level for debugging cron job execution
The cleanup job currently runs the initialize() method, which causes the running cron service to terminate incorrectly. Initialize() is not needed.
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

Successfully merging this pull request may close these issues.

Cluster support - engine should keep running until current jobs are complete
1 participant