Closed georgeboot closed 3 months ago
I like this. Let me take a day or so to think about it/ where else we need to cancel. (ref: https://github.com/film42/sidekiq-rs/issues/37)
Great, please let me know if there is anything you would like to have changed.
Thanks so much for the contribution @georgeboot ! ❤️
This was releases as v0.10.0.
We've implemented graceful shutdown using cancellation tokens from the tokio runtime.
It allows users of this crate to optionally get the cancellation token, and send the shutdown signal to sidekiq. The implementation is such that no on-hand work will ever be cancelled. This however means that sending a SIGINT doesn't mean immediate shutdown, as currently active jobs first need to finish. As soon as the cancellation token is cancelled, no new work will be taken on by the workers.
A minimal new example for using cancellation tokens is as follows:
Fixes #37