feat: switch to ThreadPool
This commit is contained in:
parent
27af53eb56
commit
2a4e5ed118
1 changed files with 1 additions and 4 deletions
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue