mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Avoid file retrieval overhead when detaching BeatmapSetInfo
It seems that no usages of `BeatmapSetInfo` detaches require files - a `WorkingBeatmap` is always obtained before doing further lookups. Therefore we can omit this include unless the detaching object is a `BeatmapInfo`. A refetch is performed when retrieving a `WorkingBeatmap` to complete the equation.
This commit is contained in:
@ -299,7 +299,23 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
#region Implementation of IWorkingBeatmapCache
|
||||
|
||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo? importedBeatmap) => workingBeatmapCache.GetWorkingBeatmap(importedBeatmap);
|
||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo? importedBeatmap)
|
||||
{
|
||||
// Detached sets don't come with files.
|
||||
// If we seem to be missing files, now is a good time to re-fetch.
|
||||
if (importedBeatmap?.BeatmapSet?.Files.Count == 0)
|
||||
{
|
||||
using (var realm = contextFactory.CreateContext())
|
||||
{
|
||||
var refetch = realm.Find<BeatmapInfo>(importedBeatmap.ID)?.Detach();
|
||||
|
||||
if (refetch != null)
|
||||
importedBeatmap = refetch;
|
||||
}
|
||||
}
|
||||
|
||||
return workingBeatmapCache.GetWorkingBeatmap(importedBeatmap);
|
||||
}
|
||||
|
||||
public WorkingBeatmap GetWorkingBeatmap(ILive<BeatmapInfo>? importedBeatmap)
|
||||
{
|
||||
|
Reference in New Issue
Block a user