Additional logging to GCS retry loop

This commit is contained in:
Jarek Kowalski
2016-09-27 21:05:01 -07:00
parent 7e9232b3c5
commit 3255606f48

View File

@@ -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
}