mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-26 07:14:12 +00:00
[126379] [go-client] chore: use WithContext functions
Signed-off-by: Nikita B <n2h9z4@gmail.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user