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:
parent
04900c1c49
commit
7a60a5e499
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user