From e59430c077ac7e2b5b87c7d0cc2ee6a6807c8153 Mon Sep 17 00:00:00 2001 From: Colin Dawson Date: Wed, 11 Feb 2026 09:37:55 +0000 Subject: [PATCH] Made AlreadyClosed exception no long throw an exception, as it's already dealt with. --- e-suite.API/eSuite.API/eSuite.API.csproj | 2 +- .../QueueProcessor/QueueProcessor.cs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/e-suite.API/eSuite.API/eSuite.API.csproj b/e-suite.API/eSuite.API/eSuite.API.csproj index 3328d64..26ebdf5 100644 --- a/e-suite.API/eSuite.API/eSuite.API.csproj +++ b/e-suite.API/eSuite.API/eSuite.API.csproj @@ -36,7 +36,7 @@ - + diff --git a/e-suite.MessageProcessor/e-suite.MessageProcessor/QueueProcessor/QueueProcessor.cs b/e-suite.MessageProcessor/e-suite.MessageProcessor/QueueProcessor/QueueProcessor.cs index 7abb1b2..fc09326 100644 --- a/e-suite.MessageProcessor/e-suite.MessageProcessor/QueueProcessor/QueueProcessor.cs +++ b/e-suite.MessageProcessor/e-suite.MessageProcessor/QueueProcessor/QueueProcessor.cs @@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging; using e_suite.MessageProcessor.Extensions; using e_suite.API.Common; using Autofac; +using RabbitMQ.Client.Exceptions; namespace e_suite.MessageProcessor.QueueProcessor; @@ -108,11 +109,9 @@ public class QueueProcessorService : IHostedService { await basicConsumer.Channel.BasicNackAsync(ea.DeliveryTag, false, true); } - catch (Exception ex1) + catch (AlreadyClosedException) { - //Do nothing here as things have already broken beyond control, and MqRaabbit has already shut things down. - //Throwing as I want to only hide the already closed exception. - throw; + //Do nothing here MqRaabbit has already shut things down. } } };