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
1 changed files with 10 additions and 7 deletions

View File

@ -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)