From 085b3bc1f22267367979e50180d808e086d7d3ac Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 3 Mar 2016 06:18:32 +0000 Subject: [PATCH] consensus: don't wait for wal if conS not running --- consensus/state.go | 2 +- consensus/wal.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/consensus/state.go b/consensus/state.go index 0f1d27ad0..22bc8c52a 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -319,7 +319,7 @@ func (cs *ConsensusState) startRoutines(maxSteps int) { func (cs *ConsensusState) OnStop() { cs.QuitService.OnStop() - if cs.wal != nil { + if cs.wal != nil && cs.IsRunning() { cs.wal.Wait() } } diff --git a/consensus/wal.go b/consensus/wal.go index 832368e6c..56bb294e4 100644 --- a/consensus/wal.go +++ b/consensus/wal.go @@ -80,7 +80,7 @@ func (wal *WAL) Save(msg ConsensusLogMessageInterface) { } } -// Must not be called concurrently. +// Must not be called concurrently with a write. func (wal *WAL) Close() { if wal != nil { wal.fp.Close()