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

Lock the BeatmapDatabase's connection during imports.

This should avoid any potential issues with intertwined transactions on the same connection while still allowing higher throughput when importing.
This commit is contained in:
Dean Herbert 2017-02-25 10:39:13 +09:00
parent 04900c1c49
commit 7a60a5e499

View File

@ -181,15 +181,18 @@ namespace osu.Game.Database
public void Import(IEnumerable<BeatmapSetInfo> beatmapSets)
{
connection.BeginTransaction();
foreach (var s in beatmapSets)
lock (connection)
{
connection.InsertWithChildren(s, true);
BeatmapSetAdded?.Invoke(s);
}
connection.BeginTransaction();
connection.Commit();
foreach (var s in beatmapSets)
{
connection.InsertWithChildren(s, true);
BeatmapSetAdded?.Invoke(s);
}
connection.Commit();
}
}
public void Delete(BeatmapSetInfo beatmapSet)