mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 02:53:06 +08:00
fixed high load on server
This commit is contained in:
@@ -54,6 +54,12 @@ namespace MQTTnet.Core.Server
|
||||
var consumable = _pendingPublishPackets.GetConsumingEnumerable();
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
if (_pendingPublishPackets.Count == 0)
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(5));
|
||||
continue;
|
||||
}
|
||||
|
||||
var packets = consumable.Take(_pendingPublishPackets.Count).ToList();
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user