Made AlreadyClosed exception no long throw an exception, as it's already dealt with.

This commit is contained in:
Colin Dawson 2026-02-11 09:37:55 +00:00
parent af02ede4e3
commit e59430c077
2 changed files with 4 additions and 5 deletions

View File

@ -36,7 +36,7 @@
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="10.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.2" />
</ItemGroup>
<ItemGroup>

View File

@ -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.
}
}
};