mirror of
https://github.com/ppy/osu
synced 2024-12-14 02:46:27 +00:00
Run each import in a single transaction
Improves performance substantially.
This commit is contained in:
parent
6eb960010f
commit
7cb87c7145
@ -47,6 +47,8 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
private readonly FileStore files;
|
||||
|
||||
private readonly SQLiteConnection connection;
|
||||
|
||||
private readonly RulesetStore rulesets;
|
||||
|
||||
private readonly BeatmapStore beatmaps;
|
||||
@ -72,6 +74,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
this.storage = storage;
|
||||
this.files = files;
|
||||
this.connection = connection;
|
||||
this.rulesets = rulesets;
|
||||
|
||||
if (importHost != null)
|
||||
@ -141,13 +144,13 @@ namespace osu.Game.Beatmaps
|
||||
/// <param name="archiveReader">The beatmap to be imported.</param>
|
||||
public BeatmapSetInfo Import(ArchiveReader archiveReader)
|
||||
{
|
||||
BeatmapSetInfo set = null;
|
||||
|
||||
// let's only allow one concurrent import at a time for now.
|
||||
lock (importLock)
|
||||
{
|
||||
BeatmapSetInfo set = importToStorage(archiveReader);
|
||||
Import(set);
|
||||
return set;
|
||||
}
|
||||
connection.RunInTransaction(() => Import(set = importToStorage(archiveReader)));
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user