1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 04:32:57 +08:00

Add timeout for all ManualResetEventSlim.Wait invocations

Timeout values were taken as best-guesses of upper values we'd expect
from sane execution.
This commit is contained in:
Dean Herbert 2022-06-23 14:33:20 +09:00
parent ed9c55a776
commit 7ef8b7df5f
6 changed files with 9 additions and 8 deletions

View File

@ -76,7 +76,7 @@ namespace osu.Game.Benchmarks
}
});
done.Wait();
done.Wait(60000);
}
[Benchmark]
@ -115,7 +115,7 @@ namespace osu.Game.Benchmarks
}
});
done.Wait();
done.Wait(60000);
}
[Benchmark]

View File

@ -79,11 +79,11 @@ namespace osu.Game.Tests.Database
{
hasThreadedUsage.Set();
stopThreadedUsage.Wait();
stopThreadedUsage.Wait(60000);
});
}, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler);
hasThreadedUsage.Wait();
hasThreadedUsage.Wait(60000);
Assert.Throws<TimeoutException>(() =>
{

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
Task.Run(() =>
{
allowResponseCallback.Wait();
allowResponseCallback.Wait(10000);
allowResponseCallback.Reset();
Schedule(() => d?.Invoke("Incorrect password"));
});

View File

@ -209,6 +209,6 @@ namespace osu.Game.Database
public void SetMigrationCompletion() => migrationComplete.Set();
public void WaitForMigrationCompletion() => migrationComplete.Wait();
public void WaitForMigrationCompletion() => migrationComplete.Wait(300000);
}
}

View File

@ -103,7 +103,7 @@ namespace osu.Game.Graphics
framesWaitedEvent.Set();
}, 10, true);
framesWaitedEvent.Wait();
framesWaitedEvent.Wait(1000);
waitDelegate.Cancel();
}
}

View File

@ -451,7 +451,8 @@ namespace osu.Game
readyToRun.Set();
}, false);
readyToRun.Wait();
if (!readyToRun.Wait(30000))
throw new TimeoutException("Attempting to block for migration took too long.");
bool? cleanupSucceded = (Storage as OsuStorage)?.Migrate(Host.GetStorage(path));