#129 ensure running jobs are not abandoned in cluster env #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ahandleExit()
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.