be more lenient on grace period

pull/3453/head
Rongjian Lan 4 years ago
parent d7ba460163
commit 8aa57bbca5
  1. 10
      consensus/leader.go

@ -303,9 +303,15 @@ func (consensus *Consensus) onCommit(msg *msg_pb.Message) {
consensus.preCommitAndPropose(blockObj)
}
consensus.getLogger().Info().Msg("[OnCommit] Starting Grace Period")
go func(viewID uint64) {
time.Sleep(1000 * time.Millisecond)
waitTime := 1000 * time.Millisecond
maxWaitTime := time.Until(consensus.NextBlockDue)
if maxWaitTime > waitTime {
waitTime = maxWaitTime
}
consensus.getLogger().Info().Str("waitTime", waitTime.String()).
Msg("[OnCommit] Starting Grace Period")
time.Sleep(waitTime)
logger.Info().Msg("[OnCommit] Commit Grace Period Ended")
consensus.mutex.Lock()

Loading…
Cancel
Save