1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 15:33: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:
Dean Herbert 2022-07-25 14:59:11 +09:00
parent bbbc0a863f
commit 2ec90e37bb

View File

@ -439,12 +439,15 @@ namespace osu.Game.Beatmaps
{
if (beatmapInfo != null)
{
// Detached sets don't come with files.
// If we seem to be missing files, now is a good time to re-fetch.
if (refetch || beatmapInfo.IsManaged || beatmapInfo.BeatmapSet?.Files.Count == 0)
{
if (refetch)
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;
beatmapInfo = Realm.Run(r => r.Find<BeatmapInfo>(id)?.Detach()) ?? beatmapInfo;
}