Skip to content

Commit 72837c5

Browse files
authored
Merge pull request #1839 from AndreReise/1825-ode-in-recovery
Cancel recovery CTS on connection Dispose
2 parents ee794f9 + 48b9910 commit 72837c5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

projects/RabbitMQ.Client/Impl/AutorecoveringConnection.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,20 @@ public async ValueTask DisposeAsync()
292292
return;
293293
}
294294

295+
try
296+
{
297+
#if NETSTANDARD2_0
298+
_recoveryCancellationTokenSource.Cancel();
299+
#else
300+
await _recoveryCancellationTokenSource.CancelAsync()
301+
.ConfigureAwait(false);
302+
#endif
303+
}
304+
catch
305+
{
306+
// Ensure dispose does not throw any exceptions.
307+
}
308+
295309
try
296310
{
297311
await _innerConnection.DisposeAsync()

0 commit comments

Comments
 (0)