|
|
|
@ -30,6 +30,23 @@ const ( |
|
|
|
defaultConcurrency = 16 |
|
|
|
) |
|
|
|
|
|
|
|
// DefaultAzBlobClientOptions returns the default Azure blob client options
|
|
|
|
// with consistent retry configuration across the application.
|
|
|
|
// This centralizes the retry policy to ensure uniform behavior between
|
|
|
|
// remote storage and replication sink implementations.
|
|
|
|
func DefaultAzBlobClientOptions() *azblob.ClientOptions { |
|
|
|
return &azblob.ClientOptions{ |
|
|
|
ClientOptions: azcore.ClientOptions{ |
|
|
|
Retry: policy.RetryOptions{ |
|
|
|
MaxRetries: 3, // Reasonable retry count - aggressive retries mask configuration errors
|
|
|
|
TryTimeout: 10 * time.Second, // Reduced from 1 minute to fail faster on auth issues
|
|
|
|
RetryDelay: 1 * time.Second, |
|
|
|
MaxRetryDelay: 10 * time.Second, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// invalidMetadataChars matches any character that is not valid in Azure metadata keys.
|
|
|
|
// Azure metadata keys must be valid C# identifiers: letters, digits, and underscores only.
|
|
|
|
var invalidMetadataChars = regexp.MustCompile(`[^a-zA-Z0-9_]`) |
|
|
|
@ -86,16 +103,7 @@ func (s azureRemoteStorageMaker) Make(conf *remote_pb.RemoteConf) (remote_storag |
|
|
|
} |
|
|
|
|
|
|
|
serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName) |
|
|
|
azClient, err := azblob.NewClientWithSharedKeyCredential(serviceURL, credential, &azblob.ClientOptions{ |
|
|
|
ClientOptions: azcore.ClientOptions{ |
|
|
|
Retry: policy.RetryOptions{ |
|
|
|
MaxRetries: 3, // Reasonable retry count - aggressive retries mask configuration errors
|
|
|
|
TryTimeout: 10 * time.Second, // Reduced from 1 minute to fail faster on auth issues
|
|
|
|
RetryDelay: 1 * time.Second, |
|
|
|
MaxRetryDelay: 10 * time.Second, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
azClient, err := azblob.NewClientWithSharedKeyCredential(serviceURL, credential, DefaultAzBlobClientOptions()) |
|
|
|
if err != nil { |
|
|
|
return nil, fmt.Errorf("failed to create Azure client: %w", err) |
|
|
|
} |
|
|
|
|