diff options
author | Tsachi Herman <tsachi.herman@algorand.com> | 2022-02-02 12:57:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 12:57:30 -0500 |
commit | 1d417308820fc102a744c934adf5862a91e577c1 (patch) | |
tree | 0e871adddb7f7363e49ba762d2999582f43d22f3 | |
parent | 1dd40a8b071eef6adf5ccd587a0584ab0648f18f (diff) |
add a warning in case the VotingKeys method exceed the time limits. (#3551)
## Summary
Add a warning in case the VotingKeys method surpasses the expected execution time limits.
## Test Plan
Tested manually.
-rw-r--r-- | agreement/pseudonode.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/agreement/pseudonode.go b/agreement/pseudonode.go index f645ca362..ed2a2c4a7 100644 --- a/agreement/pseudonode.go +++ b/agreement/pseudonode.go @@ -33,8 +33,9 @@ import ( // TODO put these in config const ( - pseudonodeVerificationBacklog = 32 - maxPseudonodeOutputWaitDuration = 2 * time.Second + pseudonodeVerificationBacklog = 32 + maxPseudonodeOutputWaitDuration = 2 * time.Second + votingKeysLoggingDurationThreashold = 200 * time.Millisecond ) var errPseudonodeBacklogFull = fmt.Errorf("pseudonode input channel is full") @@ -215,9 +216,18 @@ func (n *asyncPseudonode) loadRoundParticipationKeys(voteRound basics.Round) []a } balanceRound := balanceRound(voteRound, cparams) + // measure the time it takes to acquire the voting keys. + beforeVotingKeysTime := time.Now() + // otherwise, we want to load the participation keys. n.participationKeys = n.keys.VotingKeys(voteRound, balanceRound) n.participationKeysRound = voteRound + + votingKeysDuration := time.Since(beforeVotingKeysTime) + if votingKeysDuration > votingKeysLoggingDurationThreashold { + n.log.Warnf("asyncPseudonode: acquiring the %d voting keys for round %d took %v", len(n.participationKeys), voteRound, votingKeysDuration) + } + return n.participationKeys } |