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

feat: support retrying failed requests #8

Merged
merged 8 commits into from
Apr 2, 2024
Merged

feat: support retrying failed requests #8

merged 8 commits into from
Apr 2, 2024

Conversation

btrautmann
Copy link
Contributor

@btrautmann btrautmann commented Mar 20, 2024

📰 Summary of changes

What is the new functionality added in this PR?

This PR adds support for retrying failed network requests. In short, the following is now possible:

  • Specifying a RetryBehavior "globally" for any request made by the SturdyHttp instance
  • Specifying a RetryBehavior "locally" for a single request, which takes precedence over the RetryBehavior of the SturdyHttp instance
  • Relying on the default retry logic provided by defaultRetryClause
  • Specifying custom retry logic

Notable: This implementation does not rely on Interceptors to handle the actual retry logic as I personally have found retry logic via Interceptors to be problematic in the past. This could be changed if we find the implementation as written to not be satisfactory.

🧪 Testing done

What testing was added to cover the functionality added in this PR

Unit tests added and passing

@btrautmann btrautmann requested review from a team as code owners March 20, 2024 17:37
@codecov-commenter
Copy link

Codecov Report

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

Project coverage is 31.46%. Comparing base (141820e) to head (1301489).

Files Patch % Lines
lib/src/network_response.freezed.dart 20.00% 36 Missing ⚠️
lib/src/sturdy_http_event_listener.freezed.dart 20.00% 12 Missing ⚠️
lib/src/network_request.freezed.dart 33.33% 4 Missing ⚠️
lib/src/retry_behavior.dart 83.33% 2 Missing ⚠️
lib/src/sturdy_http.dart 96.55% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
+ Coverage   29.25%   31.46%   +2.21%     
==========================================
  Files           9       10       +1     
  Lines         670      696      +26     
==========================================
+ Hits          196      219      +23     
- Misses        474      477       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@btrautmann
Copy link
Contributor Author

/no-platform

ClaireDavis
ClaireDavis previously approved these changes Mar 20, 2024
Copy link
Contributor

@ClaireDavis ClaireDavis left a comment

Choose a reason for hiding this comment

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

this makes a lot of sense to me!

domain lgtm

Copy link
Contributor

@ClaireDavis ClaireDavis left a comment

Choose a reason for hiding this comment

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

domain lgtm

@btrautmann btrautmann merged commit 8c19dc0 into main Apr 2, 2024
3 checks passed
@btrautmann btrautmann deleted the bt/feat/retry branch April 2, 2024 15:57
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.

4 participants