@@ -14,7 +14,7 @@ import (
1414 "strings"
1515 "time"
1616
17- "github.com/cenkalti/backoff"
17+ "github.com/cenkalti/backoff/v5 "
1818 "github.com/go-logr/logr"
1919 "github.com/hashicorp/go-multierror"
2020 "github.com/prometheus/client_golang/prometheus"
@@ -330,14 +330,17 @@ func gatherAndOutputData(ctx context.Context, eventf Eventf, config CombinedConf
330330 backOff := backoff .NewExponentialBackOff ()
331331 backOff .InitialInterval = 30 * time .Second
332332 backOff .MaxInterval = 3 * time .Minute
333- backOff . MaxElapsedTime = config . BackoffMaxTime
334- post := func () error {
335- return postData (klog .NewContext (ctx , log ), config , preflightClient , readings )
333+
334+ post := func () ( any , error ) {
335+ return struct {}{}, postData (klog .NewContext (ctx , log ), config , preflightClient , readings )
336336 }
337- err := backoff .RetryNotify (post , backOff , func (err error , t time.Duration ) {
337+
338+ notificationFunc := backoff .Notify (func (err error , t time.Duration ) {
338339 eventf ("Warning" , "PushingErr" , "retrying in %v after error: %s" , t , err )
339340 log .Info ("Warning: PushingErr: retrying" , "in" , t , "reason" , err )
340341 })
342+
343+ _ , err := backoff .Retry (ctx , post , backoff .WithBackOff (backOff ), backoff .WithNotify (notificationFunc ), backoff .WithMaxElapsedTime (config .BackoffMaxTime ))
341344 if err != nil {
342345 return fmt .Errorf ("Exiting due to fatal error uploading: %v" , err )
343346 }
0 commit comments