Improvements to Worker.cs project template item

Fixes #8354
This commit is contained in:
Eilon Lipton 2019-03-08 15:43:08 -08:00
parent 1ac6f3d4fd
commit 17344cd37f
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
@ -19,7 +21,7 @@ namespace Company.Application1
{ {
while (!stoppingToken.IsCancellationRequested) while (!stoppingToken.IsCancellationRequested)
{ {
_logger.LogInformation($"Worker running at: {DateTime.Now}"); _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
await Task.Delay(1000, stoppingToken); await Task.Delay(1000, stoppingToken);
} }
} }