fixed high load on server

This commit is contained in:
JanEggers
2017-09-16 08:02:48 +02:00
parent eda8bff10b
commit 12a275918e
@@ -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
{