Fix import cancellation not correctly being forwarded to import notification

This commit is contained in:
Dean Herbert
2021-04-28 15:54:58 +09:00
parent ac1534cda2
commit 05e3a73a7d

View File

@ -156,6 +156,8 @@ namespace osu.Game.Database
bool isLowPriorityImport = tasks.Length > low_priority_import_batch_size; bool isLowPriorityImport = tasks.Length > low_priority_import_batch_size;
try
{
await Task.WhenAll(tasks.Select(async task => await Task.WhenAll(tasks.Select(async task =>
{ {
notification.CancellationToken.ThrowIfCancellationRequested(); notification.CancellationToken.ThrowIfCancellationRequested();
@ -183,6 +185,15 @@ namespace osu.Game.Database
Logger.Error(e, $@"Could not import ({task})", LoggingTarget.Database); Logger.Error(e, $@"Could not import ({task})", LoggingTarget.Database);
} }
})).ConfigureAwait(false); })).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
if (imported.Count == 0)
{
notification.State = ProgressNotificationState.Cancelled;
return imported;
}
}
if (imported.Count == 0) if (imported.Count == 0)
{ {