-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: retries for hub client #630
Conversation
This reverts commit c534d1d.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #630 +/- ##
=======================================
Coverage 44.04% 44.05%
=======================================
Files 120 120
Lines 16531 16550 +19
=======================================
+ Hits 7281 7291 +10
- Misses 8219 8224 +5
- Partials 1031 1035 +4 ☔ View full report in Codecov by Sentry. |
settlement/dymension/dymension.go
Outdated
}, retry.Context(d.ctx), retry.LastErrorOnly(true), | ||
retry.Delay(d.batchRetryDelay), retry.Attempts(d.batchRetryAttempts), retry.MaxDelay(batchRetryMaxDelay)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code is duplicated a lot
can we dry out by extracting d.retry(fn) which uses these default args?
It seems GetSequencers and GetBatchAtIndex dont require the rollapp id as args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. we can dry out as mentioned by @danwt.
yes it requires refactoring (#629) |
func (m *Manager) getLatestBatchFromSL(ctx context.Context) (*settlement.ResultRetrieveBatch, error) { | ||
var resultRetrieveBatch *settlement.ResultRetrieveBatch | ||
var err error | ||
// Get latest batch from SL | ||
err = retry.Do( | ||
func() error { | ||
resultRetrieveBatch, err = m.settlementClient.RetrieveBatch() | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
}, | ||
retry.LastErrorOnly(true), | ||
retry.Context(ctx), | ||
retry.Attempts(1), | ||
) | ||
if err != nil { | ||
return resultRetrieveBatch, err | ||
} | ||
return resultRetrieveBatch, nil | ||
return m.settlementClient.RetrieveBatch() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function could be inlined, it seems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. done in other PR
PR Standards
Opening a pull request should be able to meet the following requirements
Close #551
<-- Briefly describe the content of this pull request -->
For Author:
godoc
commentsFor Reviewer:
After reviewer approval: