我正在CloudBlobClient
设置重试政策,如下所示:
// Instantiating the client with an exponential retry policy
var client = cloudStorageAccount.CreateCloudBlobClient();
client.DefaultRequestOptions = new BlobRequestOptions()
{
RetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(1), 3)
};
// Getting a reference to the desired blob
var blobContainer = client.GetContainerReference("leases");
var blob = blobContainer.GetBlockBlobReference("someblob");
在blob上获得租约时,是否会在此租约交易中隐式执行此重试策略?
blob.AcquireLease(TimeSpan.FromSeconds(60), leaseId);
或者我是否需要明确指定重试策略:
blob.AcquireLease(TimeSpan.FromSeconds(60), leaseId, null, new BlobRequestOptions() { RetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(1), 3) });
答案 0 :(得分:3)
在获取Blob上的租约时,这个重试策略是否会隐含 在这次租赁交易中执行了什么?
是。如果您查看AcquireLease
的源代码,您会注意到该方法调用ApplyDefaults
类的BlobRequestOptions
方法,如果没有指定选项,它将从服务客户端中选择选项。< / p>