Created
May 6, 2020 20:01
-
-
Save chadly/23878399bda4a44240345633745a29bf to your computer and use it in GitHub Desktop.
process items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Task> tasks = new List<Task>(); | |
for (int i = 0; i < parallelTaskCount; i++) | |
{ | |
tasks.Add(Task.Run(async () => | |
{ | |
try | |
{ | |
await ProcessScopeAsync(provider.CreateScope()); | |
} | |
catch (Exception ex) when (Job.Config.Execution.HandleExceptions) | |
{ | |
logger.LogError(ex, $"Unhandled exception in {nameof(ExecutionBase<TConfig, TItem>.ProcessScopeAsync)}"); | |
} | |
})); | |
} | |
await Task.WhenAll(tasks); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment