Open opaolini opened 5 years ago
Definitely want to do this at some point. We might need to address #96 first.
Another part of this will be revisiting all uses of context.Background()
and making sure we actually pass down the top-level context for the entire application, so all internal ongoing requests are aborted if it gets cancelled.
About
Mesh should attempt to gracefully shutdown upon receiving a
SIGTERM
, basically allowing it to drain active connections and shutdown services. In the future it should also respond asunhealthy
/unready
when probed for health or readiness.Having a graceful shutdown would also benefit operators running mesh on Kubernetes (and probably other orchestration tools), as when pods are to be updated/moved/evicted
kubelet
sends aSIGTERM
to the main process and waits for up to a grace period (by default 30 seconds) until it sends aSIGKILL
.Below is a rough sketch implementation of that, however I should deliver a working and tested PR in the coming days if interested!
Rough implementation