Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

azureblob: handle retry error codes more carefully

Nick Craig-Wood5037d7368d83
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index fcefd19c5..c2db11267 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -656,13 +656,29 @@ func (f *Fs) shouldRetry(ctx context.Context, err error) (bool, error) {
if fserrors.ContextError(ctx, &err) {
return false, err
}
- // FIXME interpret special errors - more to do here
- if storageErr, ok := err.(*azcore.ResponseError); ok {
+ var storageErr *azcore.ResponseError
+ 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 {
case "InvalidBlobOrBlock":
// These errors happen sometimes in multipart uploads
// because of block concurrency issues
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
for _, e := range retryErrorCodes {