Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix - Ensure client side timeouts are honored #6920

Merged
merged 2 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected AmqpLinkCreator(string entityPath, ServiceBusConnection serviceBusConn

public async Task<Tuple<AmqpObject, DateTime>> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task RunOperation(Func<Task> operation, TimeSpan operationTimeout)
{
var currentRetryCount = 0;
List<Exception> exceptions = null;
var timeoutHelper = new TimeoutHelper(operationTimeout);
var timeoutHelper = new TimeoutHelper(operationTimeout, true);

if (this.IsServerBusy && timeoutHelper.RemainingTime() < RetryPolicy.ServerBusyBaseSleepTime)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ async Task<AmqpConnection> 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,
Expand Down Expand Up @@ -274,7 +274,7 @@ async Task<AmqpConnection> CreateConnectionAsync(TimeSpan timeout)

async Task<Controller> 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() };
Expand Down