Skip to content

Commit

Permalink
feat: refresh nonce on context deadline exceed
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Dec 8, 2024
1 parent 620820b commit 35b5093
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions node/pkg/reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (r *Reporter) report(ctx context.Context, pairs map[string]SubmissionData)
wg.Wait()
close(errorsChan)

isNonceErrorIncluded := false
shouldRefreshNonce := false

for err := range errorsChan {
tmp := []error{}
Expand All @@ -155,8 +155,8 @@ func (r *Reporter) report(ctx context.Context, pairs map[string]SubmissionData)
return mergeErrors(tmp)
}

if utils.IsNonceError(err) {
isNonceErrorIncluded = true
if utils.IsNonceError(err) || errors.Is(err, context.DeadlineExceeded) {
shouldRefreshNonce = true
}
}

Expand All @@ -166,7 +166,7 @@ func (r *Reporter) report(ctx context.Context, pairs map[string]SubmissionData)

log.Debug().Str("Player", "Reporter").Msgf("reporting done for reporter with interval: %v", r.SubmissionInterval)

if isNonceErrorIncluded {
if shouldRefreshNonce {
return r.KaiaHelper.FlushNoncePool(ctx)
}

Expand Down

0 comments on commit 35b5093

Please sign in to comment.