Move nested task back outside try-catch to avoid double-error

This commit is contained in:
Dean Herbert 2022-06-20 15:36:44 +09:00
parent 678b18dde6
commit 882e1c69e5
1 changed files with 7 additions and 7 deletions

View File

@ -228,13 +228,6 @@ await Task.WhenAll(tasks.Select(async task =>
if (model == null)
return null;
var scheduledImport = Task.Factory.StartNew(() => ImportModel(model, archive, batchImport, cancellationToken),
cancellationToken,
TaskCreationOptions.HideScheduler,
batchImport ? import_scheduler_batch : import_scheduler);
return await scheduledImport.ConfigureAwait(false);
}
catch (TaskCanceledException)
{
@ -245,6 +238,13 @@ await Task.WhenAll(tasks.Select(async task =>
LogForModel(model, @$"Model creation of {archive.Name} failed.", e);
return null;
}
var scheduledImport = Task.Factory.StartNew(() => ImportModel(model, archive, batchImport, cancellationToken),
cancellationToken,
TaskCreationOptions.HideScheduler,
batchImport ? import_scheduler_batch : import_scheduler);
return await scheduledImport.ConfigureAwait(false);
}
/// <summary>