Skip to content
This repository was archived by the owner on Mar 12, 2021. It is now read-only.

Commit 663ed09

Browse files
committed
GettingAheadOfOneself - fixing flaky tests
There was a race between sending the last progress message and returning from the hub method and the server does not serve the progress message if the method has already completed. Sleeping after reporting progress "fixes" the race.
1 parent 2750fee commit 663ed09

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test/signalrclient-testhost/Connections/HubConnection.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,20 @@ public async Task InvokeWithProgress(IProgress<int> progress)
6464
{
6565
for (int i = 0; i < 5; i++)
6666
{
67-
await Task.Delay(10);
6867
progress.Report(i);
68+
await Task.Delay(10);
6969
}
7070
}
7171

7272
public async Task<string> InvokeWithProgress(string jobName, IProgress<int> progress)
7373
{
7474
for (int i = 0; i < 5; i++)
7575
{
76-
await Task.Delay(10);
7776
progress.Report(i);
77+
await Task.Delay(10);
78+
7879
}
80+
7981
return string.Format("{0} done!", jobName);
8082
}
8183
}

0 commit comments

Comments
 (0)