diff options
author | Eric Erhardt <eric.erhardt@microsoft.com> | 2021-08-07 00:27:56 +0300 |
---|---|---|
committer | Eric Erhardt <eric.erhardt@microsoft.com> | 2021-08-07 00:27:56 +0300 |
commit | 96b4876793448290d4a12a30a07aae2d1df4828f (patch) | |
tree | 818f28dc11bbf91f054b1d764495d637df85a9ce /src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp | |
parent | a1da5e98b57d3d56330ebc9ae54fd2dfd57f631a (diff) |
Remove unnecessary try-catch in Worker template
This was working around a bug in 6.0 (https://github.com/dotnet/runtime/issues/56032) which will be fixed in 6.0. So we no longer need this in the default template.
Diffstat (limited to 'src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp')
-rw-r--r-- | src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp/Worker.cs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp/Worker.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp/Worker.cs index 14b4443e25..afe06c0052 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp/Worker.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp/Worker.cs @@ -14,14 +14,7 @@ public class Worker : BackgroundService while (!stoppingToken.IsCancellationRequested) { _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); - try - { - await Task.Delay(1000, stoppingToken); - } - catch (OperationCanceledException) - { - return; - } + await Task.Delay(1000, stoppingToken); } } } |