shouldRetry determines whether a given err rates being retried
(ctx context.Context, err error)
| 468 | |
| 469 | // shouldRetry determines whether a given err rates being retried |
| 470 | func 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' |
| 497 | func parsePath(path string) (root string) { |
no test coverage detected
searching dependent graphs…