From 889213b77a59dd9f4f4641f999fdc372f5af3056 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sat, 3 Jun 2023 22:32:40 -0700 Subject: [PATCH] Bound upper vote period to 5s, cut mean to 2.5s --- voter.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/voter.go b/voter.go index 254fcb7..6b1bc1d 100644 --- a/voter.go +++ b/voter.go @@ -79,15 +79,14 @@ func (v *Voter) loop() { } func (v *Voter) poll() bool { - // mean: v.period, max: v.period*2 - t := time.NewTimer(randDurationN(v.period * 2)) + t := time.NewTimer(randDurationN(v.period)) defer t.Stop() t2 := &time.Timer{} if v.vote.NumPollsSinceChange <= 10 { // mean: 100ms, max: 200ms - t2 = time.NewTimer(randDurationN(100 * time.Millisecond * 2)) + t2 = time.NewTimer(randDurationN(100 * time.Millisecond)) defer t2.Stop() }