diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index dfdb8539b..8e1b5ad32 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -274,7 +274,7 @@ func (s *service) Start() { // Shutdown implements the Service interface. func (s *service) Shutdown() { - if s.started.Load() { + if s.started.CAS(true, false) { close(s.quit) <-s.finished }