Wait for two update frames before attempting to migrate storage

This commit is contained in:
Dean Herbert 2020-09-17 16:12:18 +09:00
parent dd7c3dbc5b
commit 835c8d74b7
1 changed files with 8 additions and 0 deletions

View File

@ -272,8 +272,16 @@ private OsuGameBase loadOsu(GameHost host)
{
var osu = new OsuGameBase();
Task.Run(() => host.Run(osu));
waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time");
bool ready = false;
// wait for two update frames to be executed. this ensures that all components have had a change to run LoadComplete and hopefully avoid
// database access (GlobalActionContainer is one to do this).
host.UpdateThread.Scheduler.Add(() => host.UpdateThread.Scheduler.Add(() => ready = true));
waitForOrAssert(() => ready, @"osu! failed to start in a reasonable amount of time");
return osu;
}