mirror of
https://github.com/kopia/kopia.git
synced 2026-03-17 21:56:14 -04:00
Additional logging to GCS retry loop
This commit is contained in:
@@ -21,7 +21,7 @@ func retry(desc string, f func() (interface{}, error)) (interface{}, error) {
|
||||
retryCount := 0
|
||||
for shouldRetry(err) && retryCount < maxRetryCount {
|
||||
retryCount++
|
||||
log.Printf("Got error when calling %v. Retrying (%v/%v)...", desc, retryCount, maxRetryCount)
|
||||
log.Printf("Got error when calling %v. Retrying (%v/%v). Sleeping for %v", desc, retryCount, maxRetryCount, nextSleep)
|
||||
time.Sleep(nextSleep)
|
||||
nextSleep = time.Duration(float32(nextSleep) * multiplier)
|
||||
if nextSleep > maxSleep {
|
||||
@@ -29,6 +29,9 @@ func retry(desc string, f func() (interface{}, error)) (interface{}, error) {
|
||||
}
|
||||
v, err = f()
|
||||
}
|
||||
if retryCount > 0 {
|
||||
log.Printf("Success calling %v after %v retries.", desc, retryCount)
|
||||
}
|
||||
return v, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user