@@ -77,8 +77,7 @@ static bool ShouldTriggerConnectionRecovery(ShutdownEventArgs args)
77
77
* https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/826
78
78
* Happens when an AppDomain is unloaded
79
79
*/
80
- if ( args . Exception is ThreadAbortException &&
81
- args . ReplyCode == Constants . InternalError )
80
+ if ( args is { Exception : ThreadAbortException , ReplyCode : Constants . InternalError } )
82
81
{
83
82
return false ;
84
83
}
@@ -407,7 +406,7 @@ await _config.TopologyRecoveryExceptionHandler.QueueRecoveryExceptionHandlerAsyn
407
406
}
408
407
finally
409
408
{
410
- await _recordedEntitiesSemaphore . WaitAsync ( )
409
+ await _recordedEntitiesSemaphore . WaitAsync ( cancellationToken )
411
410
. ConfigureAwait ( false ) ;
412
411
}
413
412
}
@@ -494,7 +493,7 @@ await _recordedEntitiesSemaphore.WaitAsync(cancellationToken)
494
493
}
495
494
496
495
internal async ValueTask RecoverConsumersAsync ( AutorecoveringChannel channelToRecover , IChannel channelToUse ,
497
- bool recordedEntitiesSemaphoreHeld = false )
496
+ bool recordedEntitiesSemaphoreHeld = false , CancellationToken cancellationToken = default )
498
497
{
499
498
if ( _disposed )
500
499
{
@@ -520,7 +519,8 @@ internal async ValueTask RecoverConsumersAsync(AutorecoveringChannel channelToRe
520
519
}
521
520
finally
522
521
{
523
- _recordedEntitiesSemaphore . Wait ( ) ;
522
+ await _recordedEntitiesSemaphore . WaitAsync ( cancellationToken )
523
+ . ConfigureAwait ( false ) ;
524
524
}
525
525
526
526
string oldTag = consumer . ConsumerTag ;
@@ -540,7 +540,7 @@ internal async ValueTask RecoverConsumersAsync(AutorecoveringChannel channelToRe
540
540
}
541
541
finally
542
542
{
543
- await _recordedEntitiesSemaphore . WaitAsync ( )
543
+ await _recordedEntitiesSemaphore . WaitAsync ( cancellationToken )
544
544
. ConfigureAwait ( false ) ;
545
545
}
546
546
}
@@ -558,7 +558,7 @@ await _config.TopologyRecoveryExceptionHandler.ConsumerRecoveryExceptionHandlerA
558
558
}
559
559
finally
560
560
{
561
- await _recordedEntitiesSemaphore . WaitAsync ( )
561
+ await _recordedEntitiesSemaphore . WaitAsync ( cancellationToken )
562
562
. ConfigureAwait ( false ) ;
563
563
}
564
564
}
0 commit comments