Skip to content

Commit 6ad86ce

Browse files
committed
Run collection import process asynchronously
Actually required to avoid deadlocking..
1 parent 80ffa2c commit 6ad86ce

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

osu.Game/Database/RealmAccess.cs

+14-13
Original file line numberDiff line numberDiff line change
@@ -794,22 +794,23 @@ void convertOnlineIDs<T>() where T : RealmObject
794794
break;
795795

796796
case 21:
797-
try
798-
{
799-
// Migrate collections from external file to inside realm.
800-
// We use the "legacy" importer because that is how things were actually being saved out until now.
801-
var legacyCollectionImporter = new LegacyCollectionImporter(this);
797+
// Migrate collections from external file to inside realm.
798+
// We use the "legacy" importer because that is how things were actually being saved out until now.
799+
var legacyCollectionImporter = new LegacyCollectionImporter(this);
802800

803-
if (legacyCollectionImporter.GetAvailableCount(storage).GetResultSafely() > 0)
801+
if (legacyCollectionImporter.GetAvailableCount(storage).GetResultSafely() > 0)
802+
{
803+
legacyCollectionImporter.ImportFromStorage(storage).ContinueWith(task =>
804804
{
805-
legacyCollectionImporter.ImportFromStorage(storage).WaitSafely();
805+
if (task.Exception != null)
806+
{
807+
// can be removed 20221027 (just for initial safety).
808+
Logger.Error(task.Exception.InnerException, "Collections could not be migrated to realm. Please provide your \"collection.db\" to the dev team.");
809+
return;
810+
}
811+
806812
storage.Move("collection.db", "collection.db.migrated");
807-
}
808-
}
809-
catch (Exception e)
810-
{
811-
// can be removed 20221027 (just for initial safety).
812-
Logger.Error(e, "Collections could not be migrated to realm. Please provide your \"collection.db\" to the dev team.");
813+
});
813814
}
814815

815816
break;

0 commit comments

Comments
 (0)