1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 08:13:15 +08:00

Simplify BeatmapUpdater transaction handling using nested transaction support

This commit is contained in:
Dean Herbert 2022-07-07 17:37:46 +09:00
parent 79bed0abdf
commit e2c4c94993

View File

@ -52,15 +52,7 @@ namespace osu.Game.Beatmaps
/// <summary> /// <summary>
/// Run all processing on a beatmap immediately. /// Run all processing on a beatmap immediately.
/// </summary> /// </summary>
public void Process(BeatmapSetInfo beatmapSet) public void Process(BeatmapSetInfo beatmapSet) => beatmapSet.Realm.Write(r =>
{
if (beatmapSet.Realm.IsInTransaction)
Process(beatmapSet, beatmapSet.Realm);
else
beatmapSet.Realm.Write(r => Process(beatmapSet, r));
}
public void Process(BeatmapSetInfo beatmapSet, Realm realm)
{ {
// Before we use below, we want to invalidate. // Before we use below, we want to invalidate.
workingBeatmapCache.Invalidate(beatmapSet); workingBeatmapCache.Invalidate(beatmapSet);
@ -85,7 +77,7 @@ namespace osu.Game.Beatmaps
// And invalidate again afterwards as re-fetching the most up-to-date database metadata will be required. // And invalidate again afterwards as re-fetching the most up-to-date database metadata will be required.
workingBeatmapCache.Invalidate(beatmapSet); workingBeatmapCache.Invalidate(beatmapSet);
} });
private double calculateLength(IBeatmap b) private double calculateLength(IBeatmap b)
{ {