Skip to content

Commit 681ce59

Browse files
committed
use hash set
1 parent c0e99c6 commit 681ce59

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/SignalR/server/Core/src/DefaultHubLifetimeManager.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string me
226226
{
227227
// Each task represents the list of tasks for each of the writes within a group
228228
List<Task>? tasks = new List<Task>();
229-
230-
var connections = new ConcurrentDictionary<string, HubConnectionContext>();
229+
var connections = new HashSet<string>();
231230

232231
foreach (var groupName in groupNames)
233232
{
@@ -241,14 +240,14 @@ public override Task SendGroupsAsync(IReadOnlyList<string> groupNames, string me
241240
{
242241
foreach (var connection in group)
243242
{
244-
connections.TryAdd(connection.Key, connection.Value);
243+
connections.Add(connection.Key);
245244
}
246245
}
247246
}
248247

249-
foreach (var connection in connections)
248+
foreach (var connectionId in connections)
250249
{
251-
tasks.Add(SendConnectionAsync(connection.Key, methodName, args, cancellationToken));
250+
tasks.Add(SendConnectionAsync(connectionId, methodName, args, cancellationToken));
252251
}
253252

254253
if (tasks != null)

0 commit comments

Comments
 (0)