1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 09:42:57 +08:00

Fix hard crash when attempting to change folder location during a large import

Closes https://github.com/ppy/osu/issues/26067.
This commit is contained in:
Dean Herbert 2023-12-23 17:03:57 +09:00
parent fc56188b95
commit 8349cb7bbe
No known key found for this signature in database

View File

@ -527,14 +527,21 @@ namespace osu.Game
{ {
ManualResetEventSlim readyToRun = new ManualResetEventSlim(); ManualResetEventSlim readyToRun = new ManualResetEventSlim();
bool success = false;
Scheduler.Add(() => Scheduler.Add(() =>
{
try
{ {
realmBlocker = realm.BlockAllOperations("migration"); realmBlocker = realm.BlockAllOperations("migration");
success = true;
}
catch { }
readyToRun.Set(); readyToRun.Set();
}, false); }, false);
if (!readyToRun.Wait(30000)) if (!readyToRun.Wait(30000) || !success)
throw new TimeoutException("Attempting to block for migration took too long."); throw new TimeoutException("Attempting to block for migration took too long.");
bool? cleanupSucceded = (Storage as OsuStorage)?.Migrate(Host.GetStorage(path)); bool? cleanupSucceded = (Storage as OsuStorage)?.Migrate(Host.GetStorage(path));