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(gax): introduce RetryPolicy #572

Merged
merged 5 commits into from
Jan 3, 2025

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Jan 2, 2025

This introduces a trait and some implementations to drive retry loops.
The policy controls for how long the retry loop runs, and what errors
are considered retryable.

Part of the work for #437. #565 maybe give you a more complete picture of where this is going.

@coryan coryan force-pushed the feat-gax-retry-loop-pr3 branch from d92ba0d to 5ffb6c1 Compare January 2, 2025 17:55
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.50%. Comparing base (5201d89) to head (7b4d259).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #572      +/-   ##
==========================================
+ Coverage   72.71%   74.50%   +1.78%     
==========================================
  Files          30       31       +1     
  Lines        1085     1161      +76     
==========================================
+ Hits          789      865      +76     
  Misses        296      296              

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

@coryan coryan marked this pull request as ready for review January 2, 2025 18:52
@coryan coryan requested a review from codyoss January 2, 2025 18:52
coryan added 2 commits January 3, 2025 08:40
This introduces a trait and some implementations to drive retry loops.
The policy controls for how long the retry loop runs, and what errors
are considered retryable.
@coryan coryan force-pushed the feat-gax-retry-loop-pr3 branch from 7fa038d to 0483843 Compare January 3, 2025 13:40
src/gax/src/retry_policy.rs Outdated Show resolved Hide resolved
src/gax/src/retry_policy.rs Outdated Show resolved Hide resolved
src/gax/src/retry_policy.rs Show resolved Hide resolved
src/gax/src/retry_policy.rs Outdated Show resolved Hide resolved
@@ -89,63 +89,119 @@ impl RetryFlow {
///
/// Implementations of this trait determine if errors are retryable, and for how
/// long the retry loop may continue.
pub trait RetryPolicy: Send + Sync {
pub trait RetryPolicy: Send + Sync + std::fmt::Debug {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this trait should have a now method for clock manipulation. We could provide a default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started making this change the the tests looked more complicated. Maybe I am holding this wrong. We can try again in a future PR.

@coryan coryan merged commit faef96e into googleapis:main Jan 3, 2025
14 checks passed
@coryan coryan deleted the feat-gax-retry-loop-pr3 branch January 3, 2025 23:13
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.

2 participants