Skip to content
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

Merged
merged 6 commits into from
Apr 8, 2024
Merged

Conversation

mtsitrin
Copy link
Contributor

@mtsitrin mtsitrin commented Apr 4, 2024

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:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@mtsitrin mtsitrin linked an issue Apr 4, 2024 that may be closed by this pull request
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 44.05%. Comparing base (6406c2e) to head (62e50fe).

Files Patch % Lines
settlement/dymension/dymension.go 66.03% 12 Missing and 6 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

@mtsitrin mtsitrin marked this pull request as ready for review April 4, 2024 18:08
@mtsitrin mtsitrin requested a review from a team as a code owner April 4, 2024 18:08
@mtsitrin mtsitrin requested review from srene and zale144 April 4, 2024 18:08
@mtsitrin mtsitrin self-assigned this Apr 4, 2024
Comment on lines 559 to 560
}, retry.Context(d.ctx), retry.LastErrorOnly(true),
retry.Delay(d.batchRetryDelay), retry.Attempts(d.batchRetryAttempts), retry.MaxDelay(batchRetryMaxDelay))
Copy link
Contributor

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?

@danwt
Copy link
Contributor

danwt commented Apr 5, 2024

It seems GetSequencers and GetBatchAtIndex dont require the rollapp id as args

Copy link
Contributor

@omritoptix omritoptix left a 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.

@mtsitrin
Copy link
Contributor Author

mtsitrin commented Apr 6, 2024

It seems GetSequencers and GetBatchAtIndex dont require the rollapp id as args

yes it requires refactoring (#629)

@mtsitrin mtsitrin requested review from danwt and omritoptix April 6, 2024 17:48
Comment on lines 280 to 282
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()
}
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved anyway

Copy link
Contributor Author

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

@mtsitrin mtsitrin merged commit 48bc6bf into main Apr 8, 2024
6 checks passed
@mtsitrin mtsitrin deleted the mtsitrin/551-retries-for-hub-client branch April 8, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

retries for hub client
3 participants