mirror of https://github.com/ppy/osu
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 @@ public void Import(string path)
|
|||
|
||||
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