Fix import after direct download being scheduled to update thread

Caused a stall as experienced in #1364.
This commit is contained in:
Dean Herbert 2017-10-25 11:43:30 +09:00
parent c765785d00
commit 040fa3aa15
1 changed files with 7 additions and 3 deletions

View File

@ -246,9 +246,13 @@ public DownloadBeatmapSetRequest Download(BeatmapSetInfo beatmapSetInfo)
{
downloadNotification.State = ProgressNotificationState.Completed;
using (var stream = new MemoryStream(data))
using (var archive = new OszArchiveReader(stream))
Import(archive);
Task.Factory.StartNew(() =>
{
// This gets scheduled back to the update thread, but we want the import to run in the background.
using (var stream = new MemoryStream(data))
using (var archive = new OszArchiveReader(stream))
Import(archive);
}, TaskCreationOptions.LongRunning);
currentDownloads.Remove(request);
};