mirror of https://github.com/rclone/rclone.git
azureblob: handle retry error codes more carefully
This commit is contained in:
parent
0ccf65017f
commit
5037d7368d
|
@ -656,13 +656,29 @@ func (f *Fs) shouldRetry(ctx context.Context, err error) (bool, error) {
|
||||||
if fserrors.ContextError(ctx, &err) {
|
if fserrors.ContextError(ctx, &err) {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
// FIXME interpret special errors - more to do here
|
var storageErr *azcore.ResponseError
|
||||||
if storageErr, ok := err.(*azcore.ResponseError); ok {
|
if errors.As(err, &storageErr) {
|
||||||
|
// General errors from:
|
||||||
|
// https://learn.microsoft.com/en-us/rest/api/storageservices/common-rest-api-error-codes
|
||||||
|
// Blob specific errors from:
|
||||||
|
// https://learn.microsoft.com/en-us/rest/api/storageservices/blob-service-error-codes
|
||||||
switch storageErr.ErrorCode {
|
switch storageErr.ErrorCode {
|
||||||
case "InvalidBlobOrBlock":
|
case "InvalidBlobOrBlock":
|
||||||
// These errors happen sometimes in multipart uploads
|
// These errors happen sometimes in multipart uploads
|
||||||
// because of block concurrency issues
|
// because of block concurrency issues
|
||||||
return true, err
|
return true, err
|
||||||
|
case "InternalError":
|
||||||
|
// The server encountered an internal error. Please retry the request.
|
||||||
|
return true, err
|
||||||
|
case "OperationTimedOut":
|
||||||
|
// The operation could not be completed within the permitted time. The
|
||||||
|
// operation may or may not have succeeded on the server side. Please query
|
||||||
|
// the server state before retrying the operation.
|
||||||
|
return true, err
|
||||||
|
case "ServerBusy":
|
||||||
|
// The server is currently unable to receive requests. Please retry your
|
||||||
|
// request.
|
||||||
|
return true, err
|
||||||
}
|
}
|
||||||
statusCode := storageErr.StatusCode
|
statusCode := storageErr.StatusCode
|
||||||
for _, e := range retryErrorCodes {
|
for _, e := range retryErrorCodes {
|
||||||
|
|
Loading…
Reference in New Issue