Browse Source

wait until WAL closes the autogroup

Refs #1839
pull/1899/head
Anton Kaliaev 6 years ago
parent
commit
b242b15d40
No known key found for this signature in database GPG Key ID: 7B6881D965918214
2 changed files with 2 additions and 5 deletions
  1. +1
    -0
      consensus/reactor.go
  2. +1
    -5
      consensus/state.go

+ 1
- 0
consensus/reactor.go View File

@ -80,6 +80,7 @@ func (conR *ConsensusReactor) OnStop() {
conR.BaseReactor.OnStop() conR.BaseReactor.OnStop()
conR.unsubscribeFromBroadcastEvents() conR.unsubscribeFromBroadcastEvents()
conR.conS.Stop() conR.conS.Stop()
conR.conS.Wait()
} }
// SwitchToConsensus switches from fast_sync mode to consensus mode. // SwitchToConsensus switches from fast_sync mode to consensus mode.


+ 1
- 5
consensus/state.go View File

@ -314,13 +314,8 @@ func (cs *ConsensusState) startRoutines(maxSteps int) {
// OnStop implements cmn.Service. It stops all routines and waits for the WAL to finish. // OnStop implements cmn.Service. It stops all routines and waits for the WAL to finish.
func (cs *ConsensusState) OnStop() { func (cs *ConsensusState) OnStop() {
cs.BaseService.OnStop()
cs.evsw.Stop() cs.evsw.Stop()
cs.timeoutTicker.Stop() cs.timeoutTicker.Stop()
cs.wal.Stop()
} }
// Wait waits for the the main routine to return. // Wait waits for the the main routine to return.
@ -600,6 +595,7 @@ func (cs *ConsensusState) receiveRoutine(maxSteps int) {
// close wal now that we're done writing to it // close wal now that we're done writing to it
cs.wal.Stop() cs.wal.Stop()
cs.wal.Wait()
close(cs.done) close(cs.done)
return return


Loading…
Cancel
Save