Skip to content

Commit

Permalink
Merge pull request #3453 from rlan35/main
Browse files Browse the repository at this point in the history
be more lenient on grace period
  • Loading branch information
rlan35 authored Nov 10, 2020
2 parents d7ba460 + 2cc6d17 commit 037f622
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions consensus/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) - 200*time.Millisecond
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()
Expand Down

0 comments on commit 037f622

Please sign in to comment.