mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:13:21 +08:00
Fix calls to GetWorkingBeatmap
invalidating cache too often
With recent changes, the pathway between refetching (on request) and refetching (on requirement due to unpopulated files) was combined. Unfortunately this pathway also added a forced invalidation, which should not have been applied to the second case. Closes https://github.com/ppy/osu/issues/19365.
This commit is contained in:
parent
bbbc0a863f
commit
2ec90e37bb
@ -439,12 +439,15 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
if (beatmapInfo != null)
|
if (beatmapInfo != null)
|
||||||
{
|
{
|
||||||
// Detached sets don't come with files.
|
if (refetch)
|
||||||
// If we seem to be missing files, now is a good time to re-fetch.
|
|
||||||
if (refetch || beatmapInfo.IsManaged || beatmapInfo.BeatmapSet?.Files.Count == 0)
|
|
||||||
{
|
|
||||||
workingBeatmapCache.Invalidate(beatmapInfo);
|
workingBeatmapCache.Invalidate(beatmapInfo);
|
||||||
|
|
||||||
|
// Detached beatmapsets don't come with files as an optimisation (see `RealmObjectExtensions.beatmap_set_mapper`).
|
||||||
|
// If we seem to be missing files, now is a good time to re-fetch.
|
||||||
|
bool missingFiles = beatmapInfo.BeatmapSet?.Files.Count == 0;
|
||||||
|
|
||||||
|
if (refetch || beatmapInfo.IsManaged || missingFiles)
|
||||||
|
{
|
||||||
Guid id = beatmapInfo.ID;
|
Guid id = beatmapInfo.ID;
|
||||||
beatmapInfo = Realm.Run(r => r.Find<BeatmapInfo>(id)?.Detach()) ?? beatmapInfo;
|
beatmapInfo = Realm.Run(r => r.Find<BeatmapInfo>(id)?.Detach()) ?? beatmapInfo;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user