From 93b32777632eb79393e4f6fe0b752665c8e511ff Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 13 Jun 2023 00:59:15 +0300 Subject: lower vote expiry, send every expiry interval to partners my move anyway --- internal/quorum/quorum.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'internal/quorum') diff --git a/internal/quorum/quorum.go b/internal/quorum/quorum.go index e3f0eeb..52cf6ee 100644 --- a/internal/quorum/quorum.go +++ b/internal/quorum/quorum.go @@ -42,14 +42,12 @@ func (quo Quorum) Start(ctx context.Context) <-chan vote.Vote { for { select { case <-time.After(vote.Expiry): - if newVote, changed := quo.makeMyVote(); changed { - quo.score() - ch <- newVote - } - case vote := <-quo.voteCh: - quo.vote(vote) - if newVote, changed := quo.makeMyVote(); changed { - ch <- newVote + myVote, _ := quo.makeMyVote() + ch <- myVote + case v := <-quo.voteCh: + quo.vote(v) + if myVote, changed := quo.makeMyVote(); changed { + ch <- myVote } quo.score() case <-ctx.Done(): -- cgit v1.2.3