mirror of
https://github.com/ppy/osu
synced 2025-02-12 16:17:16 +00:00
Merge pull request #15519 from peppy/realm-ruleset-store-thread-correctness
Start initialising `RealmRulesetStore` on startup
This commit is contained in:
commit
68d6a5f2c9
@ -40,6 +40,7 @@ using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Stores;
|
||||
using osu.Game.Utils;
|
||||
using RuntimeInfo = osu.Framework.RuntimeInfo;
|
||||
|
||||
@ -160,6 +161,8 @@ namespace osu.Game
|
||||
|
||||
private readonly BindableNumber<double> globalTrackVolumeAdjust = new BindableNumber<double>(GLOBAL_TRACK_VOLUME_ADJUST);
|
||||
|
||||
private RealmRulesetStore realmRulesetStore;
|
||||
|
||||
public OsuGameBase()
|
||||
{
|
||||
UseDevelopmentServer = DebugUtils.IsDebugBuild;
|
||||
@ -231,6 +234,11 @@ namespace osu.Game
|
||||
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, API, contextFactory, Scheduler, Host, () => difficultyCache, LocalConfig));
|
||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, performOnlineLookups: true));
|
||||
|
||||
// the following realm components are not actively used yet, but initialised and kept up to date for initial testing.
|
||||
realmRulesetStore = new RealmRulesetStore(realmFactory, Storage);
|
||||
|
||||
dependencies.Cache(realmRulesetStore);
|
||||
|
||||
// this should likely be moved to ArchiveModelManager when another case appears where it is necessary
|
||||
// to have inter-dependent model managers. this could be obtained with an IHasForeign<T> interface to
|
||||
// allow lookups to be done on the child (ScoreManager in this case) to perform the cascading delete.
|
||||
@ -512,6 +520,8 @@ namespace osu.Game
|
||||
LocalConfig?.Dispose();
|
||||
|
||||
contextFactory?.FlushConnections();
|
||||
|
||||
realmRulesetStore?.Dispose();
|
||||
realmFactory?.Dispose();
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,9 @@ namespace osu.Game.Stores
|
||||
|
||||
private void addMissingRulesets()
|
||||
{
|
||||
realmFactory.Context.Write(realm =>
|
||||
using (var context = realmFactory.CreateContext())
|
||||
{
|
||||
context.Write(realm =>
|
||||
{
|
||||
var rulesets = realm.All<RealmRuleset>();
|
||||
|
||||
@ -172,6 +174,7 @@ namespace osu.Game.Stores
|
||||
availableRulesets.AddRange(detachedRulesets);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void loadFromAppDomain()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user