in src/NMS.AMQP/Provider/Failover/FailoverRequest.cs [50:86]
public async Task Run()
{
// Snapshot the current provider as this action is scoped to that
// instance and any failure we report should reflect the provider
// that was in use when the failure happened.
IProvider activeProvider = failoverProvider.ActiveProvider;
if (activeProvider == null)
{
WhenOffline(new IOException("Connection failed."));
}
else
{
try
{
await this.DoTask(activeProvider).Await();
this.taskCompletionSource.TrySetResult(true);
this.failoverProvider.RemoveFailoverRequest(this);
this.cancellationTokenSource?.Dispose();
}
catch (NMSConnectionException exception)
{
Tracer.Debug($"Caught connection exception while executing task: {this} - {exception.Message}");
WhenOffline(exception);
}
catch (NMSException exception)
{
this.failoverProvider.RemoveFailoverRequest(this);
this.taskCompletionSource.TrySetException(exception);
}
catch (Exception exception)
{
Tracer.Debug($"Caught exception while executing task: {this} - {exception.Message}");
WhenOffline(exception);
}
}
}