Add SendAsyncGroup to broadcast benchmarks (#1852)
This commit is contained in:
parent
32b4d5cc6c
commit
6b76d1355e
|
|
@ -14,6 +14,7 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
|
||||||
{
|
{
|
||||||
public class BroadcastBenchmark
|
public class BroadcastBenchmark
|
||||||
{
|
{
|
||||||
|
private const string TestGroupName = "TestGroup";
|
||||||
private DefaultHubLifetimeManager<Hub> _hubLifetimeManager;
|
private DefaultHubLifetimeManager<Hub> _hubLifetimeManager;
|
||||||
private HubContext<Hub> _hubContext;
|
private HubContext<Hub> _hubContext;
|
||||||
|
|
||||||
|
|
@ -47,6 +48,7 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
|
||||||
var hubConnection = new HubConnectionContext(connection, Timeout.InfiniteTimeSpan, NullLoggerFactory.Instance);
|
var hubConnection = new HubConnectionContext(connection, Timeout.InfiniteTimeSpan, NullLoggerFactory.Instance);
|
||||||
hubConnection.Protocol = protocol;
|
hubConnection.Protocol = protocol;
|
||||||
_hubLifetimeManager.OnConnectedAsync(hubConnection).GetAwaiter().GetResult();
|
_hubLifetimeManager.OnConnectedAsync(hubConnection).GetAwaiter().GetResult();
|
||||||
|
_hubLifetimeManager.AddGroupAsync(connection.ConnectionId, TestGroupName).GetAwaiter().GetResult();
|
||||||
|
|
||||||
_ = ConsumeAsync(connection.Application);
|
_ = ConsumeAsync(connection.Application);
|
||||||
}
|
}
|
||||||
|
|
@ -54,6 +56,12 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
|
||||||
_hubContext = new HubContext<Hub>(_hubLifetimeManager);
|
_hubContext = new HubContext<Hub>(_hubLifetimeManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public Task SendAsyncGroup()
|
||||||
|
{
|
||||||
|
return _hubContext.Clients.Group(TestGroupName).SendAsync("Method");
|
||||||
|
}
|
||||||
|
|
||||||
[Benchmark]
|
[Benchmark]
|
||||||
public Task SendAsyncAll()
|
public Task SendAsyncAll()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue