-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Update module github.com/cenkalti/backoff/v4 to v5 #11989
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ import ( | |
"fmt" | ||
"time" | ||
|
||
"github.com/cenkalti/backoff/v4" | ||
"github.com/cenkalti/backoff/v5" | ||
"go.opentelemetry.io/otel/attribute" | ||
"go.opentelemetry.io/otel/trace" | ||
"go.uber.org/zap" | ||
|
@@ -65,7 +65,7 @@ func (rs *retrySender) Shutdown(context.Context) error { | |
return nil | ||
} | ||
|
||
// send implements the requestSender interface | ||
// Send implements the requestSender interface | ||
func (rs *retrySender) Send(ctx context.Context, req internal.Request) error { | ||
// Do not use NewExponentialBackOff since it calls Reset and the code here must | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since backoff v5 does not call |
||
// call Reset after changing the InitialInterval (this saves an unnecessary call to Now). | ||
|
@@ -74,13 +74,15 @@ func (rs *retrySender) Send(ctx context.Context, req internal.Request) error { | |
RandomizationFactor: rs.cfg.RandomizationFactor, | ||
Multiplier: rs.cfg.Multiplier, | ||
MaxInterval: rs.cfg.MaxInterval, | ||
MaxElapsedTime: rs.cfg.MaxElapsedTime, | ||
Stop: backoff.Stop, | ||
Clock: backoff.SystemClock, | ||
} | ||
expBackoff.Reset() | ||
span := trace.SpanFromContext(ctx) | ||
retryNum := int64(0) | ||
if rs.cfg.MaxElapsedTime > 0 { | ||
var cancel context.CancelFunc | ||
ctx, cancel = context.WithTimeout(ctx, rs.cfg.MaxElapsedTime) | ||
// releases resources if operation completes before timeout elapses | ||
defer cancel() | ||
} | ||
for { | ||
span.AddEvent( | ||
"Sending request.", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 don't think we want this changed in this PR?
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.
Oh but it looks like backoff v5 requires Go 1.23