Skip to content

Commit

Permalink
Close balloon store when everything else is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
gdiazlo committed Feb 26, 2019
1 parent 1abc18c commit bf17b3d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions raftwal/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ func (b *RaftBalloon) Close(wait bool) error {
close(b.done)
b.wg.Wait()

// close database
if err := b.store.db.Close(); err != nil {
return err
}
b.store.db = nil

// shutdown raft
if b.raft.api != nil {
f := b.raft.api.Shutdown()
Expand All @@ -238,12 +232,19 @@ func (b *RaftBalloon) Close(wait bool) error {
if err := b.store.stable.Close(); err != nil {
return err
}

b.store.log = nil
b.store.stable = nil

// Close FSM
b.fsm.Close()

// close database
if err := b.store.db.Close(); err != nil {
return err
}
b.store.db = nil

return nil
}

Expand Down

0 comments on commit bf17b3d

Please sign in to comment.