Rethink graceful shutdown #29
Replies: 1 comment 5 replies
-
I don't think following axum is a great fit: one obvious reason is because a common use case will be to use underway with axum. To support this use case, what you really want is to be able to register handlers ( That said, I think it probably makes sense to add some kind of |
Beta Was this translation helpful? Give feedback.
-
Currently graceful shutdown communicated to all workers via
NOTIFY
, which works, but it feels not reliable, if worker misses the message - it wont shutdown gracefully.I believe it is more reliable to communicate shutdown to every worker/job directly, i was thinking about this:
(Inspired by https://github.com/tokio-rs/axum/blob/280d16a61059f57230819a79b15aa12a263e8cca/examples/graceful-shutdown/src/main.rs#L50)
timeout
will force worker to stop if it didnt gracefully stopped after signal received.Worker wont accept any new tasks after signal recieved.
This might be a little more boilerplate compared to the current solution, cause you need to set this on every job, but it gives you possibility to configure each job independently.
What do you think?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions