diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Amqp/AmqpLinkCreator.cs b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Amqp/AmqpLinkCreator.cs index a507f543a0f1a..a74aa90261c18 100644 --- a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Amqp/AmqpLinkCreator.cs +++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Amqp/AmqpLinkCreator.cs @@ -35,7 +35,7 @@ protected AmqpLinkCreator(string entityPath, ServiceBusConnection serviceBusConn public async Task> CreateAndOpenAmqpLinkAsync() { - var timeoutHelper = new TimeoutHelper(this.serviceBusConnection.OperationTimeout); + var timeoutHelper = new TimeoutHelper(this.serviceBusConnection.OperationTimeout, true); MessagingEventSource.Log.AmqpGetOrCreateConnectionStart(); var amqpConnection = await this.serviceBusConnection.ConnectionManager.GetOrCreateAsync(timeoutHelper.RemainingTime()).ConfigureAwait(false); diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Primitives/TimeoutHelper.cs b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Primitives/TimeoutHelper.cs index 34e24d5960dd0..367641a8d583f 100644 --- a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Primitives/TimeoutHelper.cs +++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Primitives/TimeoutHelper.cs @@ -13,11 +13,6 @@ struct TimeoutHelper bool deadlineSet; TimeSpan originalTimeout; - public TimeoutHelper(TimeSpan timeout) - : this(timeout, false) - { - } - public TimeoutHelper(TimeSpan timeout, bool startTimeout) { Debug.Assert(timeout >= TimeSpan.Zero, "timeout must be non-negative"); diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/RetryPolicy.cs b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/RetryPolicy.cs index 5b5047f614691..e8e41231b781c 100644 --- a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/RetryPolicy.cs +++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/RetryPolicy.cs @@ -60,7 +60,7 @@ public async Task RunOperation(Func operation, TimeSpan operationTimeout) { var currentRetryCount = 0; List exceptions = null; - var timeoutHelper = new TimeoutHelper(operationTimeout); + var timeoutHelper = new TimeoutHelper(operationTimeout, true); if (this.IsServerBusy && timeoutHelper.RemainingTime() < RetryPolicy.ServerBusyBaseSleepTime) { diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/ServiceBusConnection.cs b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/ServiceBusConnection.cs index fff210790894f..59cf5f3e364c8 100644 --- a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/ServiceBusConnection.cs +++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/ServiceBusConnection.cs @@ -244,7 +244,7 @@ async Task CreateConnectionAsync(TimeSpan timeout) { var hostName = this.Endpoint.Host; - var timeoutHelper = new TimeoutHelper(timeout); + var timeoutHelper = new TimeoutHelper(timeout, true); var amqpSettings = AmqpConnectionHelper.CreateAmqpSettings( amqpVersion: AmqpVersion, useSslStreamSecurity: true, @@ -274,7 +274,7 @@ async Task CreateConnectionAsync(TimeSpan timeout) async Task CreateControllerAsync(TimeSpan timeout) { - var timeoutHelper = new TimeoutHelper(timeout); + var timeoutHelper = new TimeoutHelper(timeout, true); var connection = await this.ConnectionManager.GetOrCreateAsync(timeoutHelper.RemainingTime()).ConfigureAwait(false); var sessionSettings = new AmqpSessionSettings { Properties = new Fields() };