dgraph
dgraph copied to clipboard
fix(zero): make zero shutdown cleanly
Zero currently has several issues related to shutdown:
- https://github.com/dgraph-io/dgraph/pull/9367 removed a call to
updateEnterpriseState()without decreasing the wait group counter. This makes zero wait indefinitely, or exit with a return code other than zero after it has been forced to terminate. - Pools never get shutdown, which keeps the pool's health check alive, resulting in logs with connection failures.
- The pool health check uses
time.Sleep, so even if pools would get shutdown, the shutdown would be delayed by the remaining sleep duration.
This PR sets the appropriate wait group counter, implements a function which removes pools on shutdown and switches from time.Sleep to time.Tick in the health check.