Skip to content

Commit afa31c7

Browse files
committed
Use async overload where possible
1 parent b65021a commit afa31c7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

projects/RabbitMQ.Client/client/impl/AutorecoveringConnection.Recovery.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ await _config.TopologyRecoveryExceptionHandler.QueueRecoveryExceptionHandlerAsyn
406406
}
407407
finally
408408
{
409-
await _recordedEntitiesSemaphore.WaitAsync()
409+
await _recordedEntitiesSemaphore.WaitAsync(cancellationToken)
410410
.ConfigureAwait(false);
411411
}
412412
}
@@ -493,7 +493,7 @@ await _recordedEntitiesSemaphore.WaitAsync(cancellationToken)
493493
}
494494

495495
internal async ValueTask RecoverConsumersAsync(AutorecoveringChannel channelToRecover, IChannel channelToUse,
496-
bool recordedEntitiesSemaphoreHeld = false)
496+
bool recordedEntitiesSemaphoreHeld = false, CancellationToken cancellationToken = default)
497497
{
498498
if (_disposed)
499499
{
@@ -519,7 +519,8 @@ internal async ValueTask RecoverConsumersAsync(AutorecoveringChannel channelToRe
519519
}
520520
finally
521521
{
522-
_recordedEntitiesSemaphore.Wait();
522+
await _recordedEntitiesSemaphore.WaitAsync(cancellationToken)
523+
.ConfigureAwait(false);
523524
}
524525

525526
string oldTag = consumer.ConsumerTag;
@@ -539,7 +540,7 @@ internal async ValueTask RecoverConsumersAsync(AutorecoveringChannel channelToRe
539540
}
540541
finally
541542
{
542-
await _recordedEntitiesSemaphore.WaitAsync()
543+
await _recordedEntitiesSemaphore.WaitAsync(cancellationToken)
543544
.ConfigureAwait(false);
544545
}
545546
}
@@ -557,7 +558,7 @@ await _config.TopologyRecoveryExceptionHandler.ConsumerRecoveryExceptionHandlerA
557558
}
558559
finally
559560
{
560-
await _recordedEntitiesSemaphore.WaitAsync()
561+
await _recordedEntitiesSemaphore.WaitAsync(cancellationToken)
561562
.ConfigureAwait(false);
562563
}
563564
}

0 commit comments

Comments
 (0)