Pārlūkot izejas kodu

fixed high load on server

release/3.x.x
JanEggers pirms 7 gadiem
vecāks
revīzija
12a275918e
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. +6
    -0
      MQTTnet.Core/Server/MqttClientMessageQueue.cs

+ 6
- 0
MQTTnet.Core/Server/MqttClientMessageQueue.cs Parādīt failu

@@ -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
{


Notiek ielāde…
Atcelt
Saglabāt