MCPcopy
hub / github.com/rclone/rclone / shouldRetry

Function shouldRetry

backend/googlecloudstorage/googlecloudstorage.go:470–494  ·  view source on GitHub ↗

shouldRetry determines whether a given err rates being retried

(ctx context.Context, err error)

Source from the content-addressed store, hash-verified

468
469// shouldRetry determines whether a given err rates being retried
470func shouldRetry(ctx context.Context, err error) (again bool, errOut error) {
471 if fserrors.ContextError(ctx, &err) {
472 return false, err
473 }
474 again = false
475 if err != nil {
476 if fserrors.ShouldRetry(err) {
477 again = true
478 } else {
479 switch gerr := err.(type) {
480 case *googleapi.Error:
481 if gerr.Code >= 500 && gerr.Code < 600 {
482 // All 5xx errors should be retried
483 again = true
484 } else if len(gerr.Errors) > 0 {
485 reason := gerr.Errors[0].Reason
486 if reason == "rateLimitExceeded" || reason == "userRateLimitExceeded" {
487 again = true
488 }
489 }
490 }
491 }
492 }
493 return again, err
494}
495
496// parsePath parses a remote 'url'
497func parsePath(path string) (root string) {

Callers 11

NewFsFunction · 0.70
listMethod · 0.70
listBucketsMethod · 0.70
makeBucketMethod · 0.70
RmdirMethod · 0.70
CopyMethod · 0.70
readObjectInfoMethod · 0.70
SetModTimeMethod · 0.70
OpenMethod · 0.70
UpdateMethod · 0.70
RemoveMethod · 0.70

Calls 2

ContextErrorFunction · 0.92
ShouldRetryFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…