feat: switch to ThreadPool

This commit is contained in:
Timothy Schenk 2023-08-13 14:22:34 +02:00
parent 27af53eb56
commit 2a4e5ed118

View file

@ -1,10 +1,7 @@
namespace Server.Services; namespace Server.Services;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using DotNext;
using DotNext.Metaprogramming;
using MassTransit.Internals; using MassTransit.Internals;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
@ -114,7 +111,7 @@ public class PacketDistributorService : IHostedService
{ {
if (this.concurrentQueue.TryDequeue(out var item)) if (this.concurrentQueue.TryDequeue(out var item))
{ {
Task.Run(() => this.InvokePacketHandler(item)); ThreadPool.QueueUserWorkItem(this.InvokePacketHandler, item, true);
} }
else else
{ {