1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 19:12:54 +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;
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.
var legacyCollectionImporter = new LegacyCollectionImporter(this);
// 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.
var legacyCollectionImporter = new LegacyCollectionImporter(this);
if (legacyCollectionImporter.GetAvailableCount(storage).GetResultSafely() > 0)
{
legacyCollectionImporter.ImportFromStorage(storage).WaitSafely();
storage.Move("collection.db", "collection.db.migrated");
}
}
catch (Exception e)
if (legacyCollectionImporter.GetAvailableCount(storage).GetResultSafely() > 0)
{
// can be removed 20221027 (just for initial safety).
Logger.Error(e, "Collections could not be migrated to realm. Please provide your \"collection.db\" to the dev team.");
legacyCollectionImporter.ImportFromStorage(storage).ContinueWith(task =>
{
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;