From 2a4e5ed1180c6d9ed354881fa29bca33541057c1 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Sun, 13 Aug 2023 14:22:34 +0200 Subject: [PATCH] feat: switch to ThreadPool --- Server/Services/PacketDistributorService.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Server/Services/PacketDistributorService.cs b/Server/Services/PacketDistributorService.cs index 93cf24c..54c42fc 100644 --- a/Server/Services/PacketDistributorService.cs +++ b/Server/Services/PacketDistributorService.cs @@ -1,10 +1,7 @@ namespace Server.Services; using System.Collections.Concurrent; -using System.Linq.Expressions; using System.Reflection; -using DotNext; -using DotNext.Metaprogramming; using MassTransit.Internals; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -114,7 +111,7 @@ public class PacketDistributorService : IHostedService { if (this.concurrentQueue.TryDequeue(out var item)) { - Task.Run(() => this.InvokePacketHandler(item)); + ThreadPool.QueueUserWorkItem(this.InvokePacketHandler, item, true); } else {