1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 21:53:22 +08:00

Run collection import process asynchronously

Actually required to avoid deadlocking..
This commit is contained in:
Dean Herbert 2022-07-31 01:06:55 +09:00
parent 80ffa2cf20
commit 6ad86ce5b7

View File

@ -794,22 +794,23 @@ namespace osu.Game.Database
break; break;
case 21: case 21:
try // Migrate collections from external file to inside realm.
{ // We use the "legacy" importer because that is how things were actually being saved out until now.
// Migrate collections from external file to inside realm. var legacyCollectionImporter = new LegacyCollectionImporter(this);
// We use the "legacy" importer because that is how things were actually being saved out until now.
var legacyCollectionImporter = new LegacyCollectionImporter(this);
if (legacyCollectionImporter.GetAvailableCount(storage).GetResultSafely() > 0) if (legacyCollectionImporter.GetAvailableCount(storage).GetResultSafely() > 0)
{
legacyCollectionImporter.ImportFromStorage(storage).WaitSafely();
storage.Move("collection.db", "collection.db.migrated");
}
}
catch (Exception e)
{ {
// can be removed 20221027 (just for initial safety). legacyCollectionImporter.ImportFromStorage(storage).ContinueWith(task =>
Logger.Error(e, "Collections could not be migrated to realm. Please provide your \"collection.db\" to the dev team."); {
if (task.Exception != null)
{
// can be removed 20221027 (just for initial safety).
Logger.Error(task.Exception.InnerException, "Collections could not be migrated to realm. Please provide your \"collection.db\" to the dev team.");
return;
}
storage.Move("collection.db", "collection.db.migrated");
});
} }
break; break;