diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-01-28 17:38:37 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-02-01 12:11:53 +0300 |
commit | 88fc02519e91504274d5745b24182e34a3a2c780 (patch) | |
tree | b29000efd4041e62cf300d072bd33a41d6513bd6 /internal/praefect/transactions | |
parent | a08019e6ab078b0bf68510421b5078b2f308110d (diff) |
transactions: Improve misleading comment
The comment when we check whether we have won the vote or not is quite
misleading, as it talks about winning while it applies to a block which
is returning an error message. Let's rephrase the error message to make
it clearer.
Diffstat (limited to 'internal/praefect/transactions')
-rw-r--r-- | internal/praefect/transactions/subtransaction.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/praefect/transactions/subtransaction.go b/internal/praefect/transactions/subtransaction.go index 4b836b80b..fab1355a5 100644 --- a/internal/praefect/transactions/subtransaction.go +++ b/internal/praefect/transactions/subtransaction.go @@ -217,8 +217,9 @@ func (t *subtransaction) collectVotes(ctx context.Context, node string) error { return fmt.Errorf("voter is in invalid state %d: %q", voter.result, node) } - // See if our vote crossed the threshold. As there can be only one vote - // exceeding it, we know we're the winner in that case. + // See if our vote crossed the threshold. If not, then we know we + // cannot have won as the transaction is being wrapped up already and + // shouldn't accept any additional votes. if t.voteCounts[voter.vote] < t.threshold { voter.result = VoteFailed return fmt.Errorf("%w: got %d/%d votes", ErrTransactionFailed, t.voteCounts[voter.vote], t.threshold) |