mirror of
https://github.com/ppy/osu.git
synced 2025-03-24 04:38:44 +08:00
Merge pull request #16633 from peppy/fix-collection-migration
Block collection loading until realm migration has completed
This commit is contained in:
commit
b7aa26bc5f
osu.Game
@ -50,9 +50,14 @@ namespace osu.Game.Collections
|
|||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private DatabaseContextFactory efContextFactory { get; set; } = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
efContextFactory?.WaitForMigrationCompletion();
|
||||||
|
|
||||||
Collections.CollectionChanged += collectionsChanged;
|
Collections.CollectionChanged += collectionsChanged;
|
||||||
|
|
||||||
if (storage.Exists(database_backup_name))
|
if (storage.Exists(database_backup_name))
|
||||||
|
@ -184,5 +184,11 @@ namespace osu.Game.Database
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static string CreateDatabaseConnectionString(string filename, Storage storage) => string.Concat("Data Source=", storage.GetFullPath($@"{filename}", true));
|
public static string CreateDatabaseConnectionString(string filename, Storage storage) => string.Concat("Data Source=", storage.GetFullPath($@"{filename}", true));
|
||||||
|
|
||||||
|
private readonly ManualResetEventSlim migrationComplete = new ManualResetEventSlim();
|
||||||
|
|
||||||
|
public void SetMigrationCompletion() => migrationComplete.Set();
|
||||||
|
|
||||||
|
public void WaitForMigrationCompletion() => migrationComplete.Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,7 @@ namespace osu.Game.Database
|
|||||||
}, TaskCreationOptions.LongRunning).ContinueWith(t =>
|
}, TaskCreationOptions.LongRunning).ContinueWith(t =>
|
||||||
{
|
{
|
||||||
migrationCompleted.SetResult(true);
|
migrationCompleted.SetResult(true);
|
||||||
|
efContextFactory.SetMigrationCompletion();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user