File tree 5 files changed +49
-14
lines changed
5 files changed +49
-14
lines changed Original file line number Diff line number Diff line change @@ -283,11 +283,17 @@ public async ValueTask DisposeAsync()
283
283
await this . AbortAsync ( )
284
284
. ConfigureAwait ( false ) ;
285
285
}
286
-
287
- _recordedConsumerTags . Clear ( ) ;
288
286
}
289
287
finally
290
288
{
289
+ try
290
+ {
291
+ _recordedConsumerTags . Clear ( ) ;
292
+ }
293
+ catch
294
+ {
295
+ }
296
+
291
297
_disposed = true ;
292
298
}
293
299
}
Original file line number Diff line number Diff line change @@ -296,18 +296,24 @@ public async ValueTask DisposeAsync()
296
296
{
297
297
await _innerConnection . DisposeAsync ( )
298
298
. ConfigureAwait ( false ) ;
299
-
300
- _channels . Clear ( ) ;
301
- _recordedEntitiesSemaphore . Dispose ( ) ;
302
- _channelsSemaphore . Dispose ( ) ;
303
- _recoveryCancellationTokenSource . Dispose ( ) ;
304
299
}
305
300
catch ( OperationInterruptedException )
306
301
{
307
302
// ignored, see rabbitmq/rabbitmq-dotnet-client#133
308
303
}
309
304
finally
310
305
{
306
+ try
307
+ {
308
+ _channels . Clear ( ) ;
309
+ _recordedEntitiesSemaphore . Dispose ( ) ;
310
+ _channelsSemaphore . Dispose ( ) ;
311
+ _recoveryCancellationTokenSource . Dispose ( ) ;
312
+ }
313
+ catch
314
+ {
315
+ }
316
+
311
317
_disposed = true ;
312
318
}
313
319
}
Original file line number Diff line number Diff line change @@ -573,15 +573,23 @@ protected virtual void Dispose(bool disposing)
573
573
this . AbortAsync ( ) . GetAwaiter ( ) . GetResult ( ) ;
574
574
}
575
575
576
- _serverOriginatedChannelCloseTcs ? . Task . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
576
+ _serverOriginatedChannelCloseTcs ? . Task . Wait ( InternalConstants . DefaultChannelDisposeTimeout ) ;
577
577
578
578
ConsumerDispatcher . Dispose ( ) ;
579
- _rpcSemaphore . Dispose ( ) ;
580
- _confirmSemaphore . Dispose ( ) ;
579
+
581
580
_outstandingPublisherConfirmationsRateLimiter ? . Dispose ( ) ;
582
581
}
583
582
finally
584
583
{
584
+ try
585
+ {
586
+ _rpcSemaphore . Dispose ( ) ;
587
+ _confirmSemaphore . Dispose ( ) ;
588
+ }
589
+ catch
590
+ {
591
+ }
592
+
585
593
_disposed = true ;
586
594
}
587
595
}
@@ -622,13 +630,11 @@ await this.AbortAsync()
622
630
623
631
if ( _serverOriginatedChannelCloseTcs is not null )
624
632
{
625
- await _serverOriginatedChannelCloseTcs . Task . WaitAsync ( TimeSpan . FromSeconds ( 5 ) )
633
+ await _serverOriginatedChannelCloseTcs . Task . WaitAsync ( InternalConstants . DefaultChannelDisposeTimeout )
626
634
. ConfigureAwait ( false ) ;
627
635
}
628
636
629
637
ConsumerDispatcher . Dispose ( ) ;
630
- _rpcSemaphore . Dispose ( ) ;
631
- _confirmSemaphore . Dispose ( ) ;
632
638
633
639
if ( _outstandingPublisherConfirmationsRateLimiter is not null )
634
640
{
@@ -638,6 +644,15 @@ await _outstandingPublisherConfirmationsRateLimiter.DisposeAsync()
638
644
}
639
645
finally
640
646
{
647
+ try
648
+ {
649
+ _rpcSemaphore . Dispose ( ) ;
650
+ _confirmSemaphore . Dispose ( ) ;
651
+ }
652
+ catch
653
+ {
654
+ }
655
+
641
656
_disposed = true ;
642
657
}
643
658
}
Original file line number Diff line number Diff line change @@ -550,7 +550,14 @@ await _channel0.DisposeAsync()
550
550
}
551
551
finally
552
552
{
553
- _mainLoopCts . Dispose ( ) ;
553
+ try
554
+ {
555
+ _mainLoopCts . Dispose ( ) ;
556
+ }
557
+ catch
558
+ {
559
+ }
560
+
554
561
_disposed = true ;
555
562
}
556
563
}
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ internal static class InternalConstants
37
37
{
38
38
internal static readonly TimeSpan DefaultConnectionAbortTimeout = TimeSpan . FromSeconds ( 5 ) ;
39
39
internal static readonly TimeSpan DefaultConnectionCloseTimeout = TimeSpan . FromSeconds ( 30 ) ;
40
+ internal static readonly TimeSpan DefaultChannelDisposeTimeout = TimeSpan . FromSeconds ( 5 ) ;
40
41
41
42
/// <summary>
42
43
/// Largest message size, in bytes, allowed in RabbitMQ.
You can’t perform that action at this time.
0 commit comments