Commit 094423af authored by Felipe Andrade's avatar Felipe Andrade

move consensus shutdown nested inside the backend group

parent 845cfce4
...@@ -706,6 +706,12 @@ func (b *BackendGroup) loadBalancedConsensusGroup() []*Backend { ...@@ -706,6 +706,12 @@ func (b *BackendGroup) loadBalancedConsensusGroup() []*Backend {
return backendsHealthy return backendsHealthy
} }
func (bg *BackendGroup) Shutdown() {
if bg.Consensus != nil {
bg.Consensus.Shutdown()
}
}
func calcBackoff(i int) time.Duration { func calcBackoff(i int) time.Duration {
jitter := float64(rand.Int63n(250)) jitter := float64(rand.Int63n(250))
ms := math.Min(math.Pow(2, float64(i))*1000+jitter, 3000) ms := math.Min(math.Pow(2, float64(i))*1000+jitter, 3000)
......
...@@ -225,9 +225,7 @@ func (s *Server) Shutdown() { ...@@ -225,9 +225,7 @@ func (s *Server) Shutdown() {
_ = s.wsServer.Shutdown(context.Background()) _ = s.wsServer.Shutdown(context.Background())
} }
for _, bg := range s.BackendGroups { for _, bg := range s.BackendGroups {
if bg.Consensus != nil { bg.Shutdown()
bg.Consensus.Shutdown()
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment