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.
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.