mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-25 23:53:07 +08:00
Remove batch sending of messages to prevent message reordering and several required awaits.
This commit is contained in:
@@ -65,7 +65,7 @@ namespace MQTTnet.Benchmarks
|
||||
|
||||
for (var i = 0; i < 10000; i++)
|
||||
{
|
||||
_channelAdapter.SendPacketsAsync(TimeSpan.FromSeconds(15), new[] { _packet }, CancellationToken.None).GetAwaiter().GetResult();
|
||||
_channelAdapter.SendPacketAsync(TimeSpan.FromSeconds(15), _packet, CancellationToken.None).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
_stream.Position = 0;
|
||||
|
||||
@@ -36,14 +36,11 @@ namespace MQTTnet.Core.Tests
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task SendPacketsAsync(TimeSpan timeout, IEnumerable<MqttBasePacket> packets, CancellationToken cancellationToken)
|
||||
public Task SendPacketAsync(TimeSpan timeout, MqttBasePacket packet, CancellationToken cancellationToken)
|
||||
{
|
||||
ThrowIfPartnerIsNull();
|
||||
|
||||
foreach (var packet in packets)
|
||||
{
|
||||
Partner.EnqueuePacketInternal(packet);
|
||||
}
|
||||
Partner.EnqueuePacketInternal(packet);
|
||||
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user