[126379] [go-client] chore: use WithContext functions

Signed-off-by: Nikita B <n2h9z4@gmail.com>
This commit is contained in:
Nikita B
2025-09-22 19:36:45 +02:00
parent 1aec2eb003
commit 51c525a140
2 changed files with 4 additions and 7 deletions

View File

@@ -136,7 +136,7 @@ func (b *URLBackoff) UpdateBackoffWithContext(ctx context.Context, actualURL *ur
// CalculateBackoff takes a url and back's off exponentially,
// based on its knowledge of existing failures.
func (b *URLBackoff) CalculateBackoff(actualURL *url.URL) time.Duration {
return b.Backoff.Get(b.baseUrlKey(actualURL))
return b.CalculateBackoffWithContext(context.Background(), actualURL)
}
// CalculateBackoffWithContext takes a url and back's off exponentially,
@@ -146,7 +146,7 @@ func (b *URLBackoff) CalculateBackoffWithContext(ctx context.Context, actualURL
}
func (b *URLBackoff) Sleep(d time.Duration) {
b.Backoff.Clock.Sleep(d)
b.SleepWithContext(context.Background(), d)
}
func (b *URLBackoff) SleepWithContext(ctx context.Context, d time.Duration) {

View File

@@ -96,11 +96,8 @@ var _ WarningHandlerWithContext = NoWarnings{}
// WarningLogger is an implementation of [WarningHandler] and [WarningHandlerWithContext] that logs code 299 warnings
type WarningLogger struct{}
func (WarningLogger) HandleWarningHeader(code int, agent string, message string) {
if code != 299 || len(message) == 0 {
return
}
klog.Background().Info("Warning: " + message)
func (w WarningLogger) HandleWarningHeader(code int, agent string, message string) {
w.HandleWarningHeaderWithContext(context.Background(), code, agent, message)
}
func (WarningLogger) HandleWarningHeaderWithContext(ctx context.Context, code int, agent string, message string) {