Skip to content

Commit

Permalink
#210 Provisional solution to fix racing condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarri committed Mar 17, 2020
1 parent 864d012 commit b29ad19
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions consensus/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package consensus

import (
"fmt"
"time"

"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/privval"
"github.com/lightstreams-network/lightchain/log"
Expand Down Expand Up @@ -107,9 +109,13 @@ func (n *Node) Stop() error {
n.logger.Info("Tendermint node stopped")
}

// Wait a seconds to buy time for tendermint to finish node stopping events
<-time.After(time.Second)

for ctxID, db := range n.dbs {
n.logger.Info(fmt.Sprintf("Closing database '%s'...", ctxID))
db.Close()
n.logger.Info(fmt.Sprintf("Database '%s' closed", ctxID))
}

return nil
Expand Down

0 comments on commit b29ad19

Please sign in to comment.