Skip to content

Commit ed33c7d

Browse files
committed
deflake
1 parent 3eb871f commit ed33c7d

File tree

1 file changed

+6
-6
lines changed
  • test/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs

1 file changed

+6
-6
lines changed

test/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs/HubFacts.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ private async Task SendToMultipleUsers(string hubName)
198198
{
199199
InitializeUserByQuerystring(host);
200200

201-
var wh1 = new AsyncManualResetEvent();
202-
var wh2 = new AsyncManualResetEvent();
201+
var wh1 = new TaskCompletionSource<object>();
202+
var wh2 = new TaskCompletionSource<object>();
203203

204204
var connection1 = GetUserConnection("myUser");
205205
var connection2 = GetUserConnection("myUser2");
@@ -210,16 +210,16 @@ private async Task SendToMultipleUsers(string hubName)
210210
var proxy1 = connection1.CreateHubProxy(hubName);
211211
var proxy2 = connection2.CreateHubProxy(hubName);
212212

213-
proxy1.On("send", wh1.Set);
214-
proxy1.On("send", wh2.Set);
213+
proxy1.On("send", () => wh1.TrySetResult(null));
214+
proxy1.On("send", () => wh2.TrySetResult(null));
215215

216216
await connection1.Start(host);
217217
await connection2.Start(host);
218218

219219
await proxy1.Invoke("SendToUsers", new List<string> { "myUser", "myUser2" });
220220

221-
Assert.True(await wh1.WaitAsync(TimeSpan.FromSeconds(5)));
222-
Assert.True(await wh2.WaitAsync(TimeSpan.FromSeconds(5)));
221+
await wh1.Task.OrTimeout();
222+
await wh2.Task.OrTimeout();
223223
}
224224
}
225225
}

0 commit comments

Comments
 (0)