From 1cdff7f0bed65a5cfe9a872ec925a13d171ff7e3 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Sat, 25 Nov 2023 14:31:30 +0100 Subject: [PATCH] chore: PacketDistributorService disposable --- Server/Services/PacketDistributorService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Server/Services/PacketDistributorService.cs b/Server/Services/PacketDistributorService.cs index 5b3e6aa..1d19c40 100644 --- a/Server/Services/PacketDistributorService.cs +++ b/Server/Services/PacketDistributorService.cs @@ -23,7 +23,7 @@ namespace Server.Services; using static CodeGenerator; using static ExpressionBuilder; -public class PacketDistributorService : IHostedService +public class PacketDistributorService : IHostedService, IDisposable { private readonly ConcurrentQueue _concurrentQueue; @@ -178,4 +178,10 @@ public class PacketDistributorService : IHostedService _logger.PacketData(JsonConvert.SerializeObject(packet)); _logger.PacketFinished(item.Session.Id, item.OperationCode); } + + public void Dispose() + { + GC.SuppressFinalize(this); + _activitySource.Dispose(); + } }