move consensus shutdown nested inside the backend group

This commit is contained in:
Felipe Andrade 2023-05-17 21:56:55 -07:00
parent 806ad4c5b1
commit 4c08681043
2 changed files with 7 additions and 3 deletions

@ -706,6 +706,12 @@ func (b *BackendGroup) loadBalancedConsensusGroup() []*Backend {
return backendsHealthy
}
func (bg *BackendGroup) Shutdown() {
if bg.Consensus != nil {
bg.Consensus.Shutdown()
}
}
func calcBackoff(i int) time.Duration {
jitter := float64(rand.Int63n(250))
ms := math.Min(math.Pow(2, float64(i))*1000+jitter, 3000)

@ -225,9 +225,7 @@ func (s *Server) Shutdown() {
_ = s.wsServer.Shutdown(context.Background())
}
for _, bg := range s.BackendGroups {
if bg.Consensus != nil {
bg.Consensus.Shutdown()
}
bg.Shutdown()
}
}