Merge pull request #1899 from tendermint/1839-shutdown-wal-properly

Properly shutdown consensus WAL
This commit is contained in:
Alexander Simmerl 2018-07-04 15:23:25 +02:00 committed by GitHub
commit 5cfd8ebaa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

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

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.
func (cs *ConsensusState) OnStop() {
cs.BaseService.OnStop()
cs.evsw.Stop()
cs.timeoutTicker.Stop()
cs.wal.Stop()
}
// 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
cs.wal.Stop()
cs.wal.Wait()
close(cs.done)
return