1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +08:00

Order imports depending on beatmap imports if any is running.

This commit is contained in:
Lucas A 2021-05-09 18:15:21 +02:00
parent 851e33fd15
commit 325a689d65

View File

@ -48,18 +48,29 @@ namespace osu.Game.Database
var stableStorage = await getStableStorage().ConfigureAwait(false);
var importTasks = new List<Task>();
Task beatmapImportTask = default;
if (content.HasFlagFast(StableContent.Beatmaps))
importTasks.Add(beatmaps.ImportFromStableAsync(stableStorage));
if (content.HasFlagFast(StableContent.Collections))
importTasks.Add(collections.ImportFromStableAsync(stableStorage));
if (content.HasFlagFast(StableContent.Scores))
importTasks.Add(scores.ImportFromStableAsync(stableStorage));
importTasks.Add(beatmapImportTask = beatmaps.ImportFromStableAsync(stableStorage));
if (content.HasFlagFast(StableContent.Skins))
importTasks.Add(skins.ImportFromStableAsync(stableStorage));
if (content.HasFlagFast(StableContent.Collections))
{
if (beatmapImportTask != null)
importTasks.Add(beatmapImportTask.ContinueWith(_ => collections.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
else
importTasks.Add(collections.ImportFromStableAsync(stableStorage));
}
if (content.HasFlagFast(StableContent.Scores))
{
if (beatmapImportTask != null)
importTasks.Add(beatmapImportTask.ContinueWith(_ => scores.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
else
importTasks.Add(scores.ImportFromStableAsync(stableStorage));
}
await Task.WhenAll(importTasks.ToArray()).ConfigureAwait(false);
}