-
Notifications
You must be signed in to change notification settings - Fork 25
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
Conversation
d92ba0d
to
5ffb6c1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
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.
7fa038d
to
0483843
Compare
@@ -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 { |
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.
I wonder if this trait should have a now method for clock manipulation. We could provide a default.
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.
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.
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.