From ba2b689997961d7746cc7bd2a9bdee13adc1bcca Mon Sep 17 00:00:00 2001 From: Ziya Suzen Date: Wed, 24 Jan 2024 22:43:12 +0000 Subject: [PATCH] Fix unnecessary error log on dispose (#354) --- src/NATS.Client.Core/NatsConnection.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/NATS.Client.Core/NatsConnection.cs b/src/NATS.Client.Core/NatsConnection.cs index 97b2674a9..fac33fc07 100644 --- a/src/NATS.Client.Core/NatsConnection.cs +++ b/src/NATS.Client.Core/NatsConnection.cs @@ -640,6 +640,10 @@ private async Task PublishEventsAsync() } } } + catch (OperationCanceledException) + { + // Ignore, we're disposing the connection + } catch (Exception ex) { _logger.LogError(NatsLogEvents.Connection, ex, "Error occured when publishing events");