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
|
||||
{
|
||||
private const string TestGroupName = "TestGroup";
|
||||
private DefaultHubLifetimeManager<Hub> _hubLifetimeManager;
|
||||
private HubContext<Hub> _hubContext;
|
||||
|
||||
|
|
@ -47,6 +48,7 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
|
|||
var hubConnection = new HubConnectionContext(connection, Timeout.InfiniteTimeSpan, NullLoggerFactory.Instance);
|
||||
hubConnection.Protocol = protocol;
|
||||
_hubLifetimeManager.OnConnectedAsync(hubConnection).GetAwaiter().GetResult();
|
||||
_hubLifetimeManager.AddGroupAsync(connection.ConnectionId, TestGroupName).GetAwaiter().GetResult();
|
||||
|
||||
_ = ConsumeAsync(connection.Application);
|
||||
}
|
||||
|
|
@ -54,6 +56,12 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
|
|||
_hubContext = new HubContext<Hub>(_hubLifetimeManager);
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public Task SendAsyncGroup()
|
||||
{
|
||||
return _hubContext.Clients.Group(TestGroupName).SendAsync("Method");
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public Task SendAsyncAll()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue