Skip to content

Commit

Permalink
Prevent hanging in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Jul 20, 2024
1 parent cd32d47 commit 14f25ca
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ private static async Task AssertNoOverlap(Func<Task> firstAction, Func<Task> sec
{
// Run first task and wait until we've entered it
var firstTask = firstAction();
await firstEntered.WaitAsync();
await firstEntered.WaitAsync().WithTimeout(TimeSpan.FromSeconds(30));

// Run second task, we should never enter it
var secondTask = secondAction();
Expand All @@ -374,7 +374,7 @@ private static async Task AssertNoOverlap(Func<Task> firstAction, Func<Task> sec
firstRelease.Set();

// Now we should enter first one
await secondEntered.WaitAsync();
await secondEntered.WaitAsync().WithTimeout(TimeSpan.FromSeconds(30));
await Task.WhenAll(firstTask, secondTask);
}

Expand Down

0 comments on commit 14f25ca

Please sign in to comment.