1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Optimize realm transactions for editor Save action

This commit is contained in:
OliBomby 2023-07-13 14:33:21 +02:00
parent 9cba24e32c
commit cde8d8e7f1

View File

@ -431,8 +431,9 @@ namespace osu.Game.Beatmaps
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
beatmapInfo.ResetOnlineInfo();
using (var stream = new MemoryStream())
Realm.Write(r =>
{
using var stream = new MemoryStream();
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
new LegacyBeatmapEncoder(beatmapContent, beatmapSkin).Encode(sw);
@ -458,8 +459,6 @@ namespace osu.Game.Beatmaps
updateHashAndMarkDirty(setInfo);
Realm.Write(r =>
{
var liveBeatmapSet = r.Find<BeatmapSetInfo>(setInfo.ID)!;
setInfo.CopyChangesToRealm(liveBeatmapSet);
@ -474,7 +473,6 @@ namespace osu.Game.Beatmaps
// this is a locally-modified set now, so looking up metadata is busy work at best and harmful at worst.
ProcessBeatmap?.Invoke(liveBeatmapSet, MetadataLookupScope.None);
});
}
Debug.Assert(beatmapInfo.BeatmapSet != null);