@@ -16,6 +16,7 @@ namespace Microsoft.Azure.EventHubs.Processor
1616 class AzureStorageCheckpointLeaseManager : ICheckpointManager , ILeaseManager
1717 {
1818 static string MetaDataOwnerName = "OWNINGHOST" ;
19+ static TimeSpan MinListBlobsTimeout = TimeSpan . FromSeconds ( 10 ) ;
1920
2021 EventProcessorHost host ;
2122 TimeSpan leaseDuration ;
@@ -26,6 +27,7 @@ class AzureStorageCheckpointLeaseManager : ICheckpointManager, ILeaseManager
2627 readonly string leaseContainerName ;
2728 readonly string storageBlobPrefix ;
2829 BlobRequestOptions defaultRequestOptions ;
30+ BlobRequestOptions listBlobsRequestOptions ;
2931 OperationContext operationContext = null ;
3032 CloudBlobContainer eventHubContainer ;
3133 CloudBlobDirectory consumerGroupDirectory ;
@@ -79,6 +81,15 @@ internal void Initialize(EventProcessorHost host)
7981 MaximumExecutionTime = TimeSpan . FromSeconds ( this . LeaseRenewInterval . TotalSeconds )
8082 } ;
8183
84+ // Storage suggests to use at least 10 seconds timeout at list-blobs calls.
85+ this . listBlobsRequestOptions = new BlobRequestOptions ( )
86+ {
87+ ServerTimeout = this . defaultRequestOptions . ServerTimeout ,
88+ MaximumExecutionTime = this . defaultRequestOptions . MaximumExecutionTime
89+ } ;
90+ this . listBlobsRequestOptions . ServerTimeout = this . listBlobsRequestOptions . ServerTimeout < MinListBlobsTimeout ?
91+ MinListBlobsTimeout : this . listBlobsRequestOptions . ServerTimeout ;
92+
8293#if FullNetFx
8394 // Proxy enabled?
8495 if ( this . host . EventProcessorOptions != null && this . host . EventProcessorOptions . WebProxy != null )
@@ -247,7 +258,7 @@ public async Task<IEnumerable<Lease>> GetAllLeasesAsync()
247258 BlobListingDetails . Metadata ,
248259 null ,
249260 continuationToken ,
250- this . defaultRequestOptions ,
261+ this . listBlobsRequestOptions ,
251262 this . operationContext ) ;
252263
253264 // ListBlobsSegmentedAsync honors neither timeout settings in request options nor cancellation token and thus intermittently hangs.
0 commit comments