refactor: remove unnecessary while loop in Worker.Execute

This commit is contained in:
Developer 02 2025-11-04 15:18:38 +01:00
parent f611e74de1
commit 0a175b9e9d

View File

@ -18,14 +18,11 @@ namespace EnvelopeGenerator.Finalizer
public async Task Execute(IJobExecutionContext context) public async Task Execute(IJobExecutionContext context)
{ {
while (!context.CancellationToken.IsCancellationRequested) if (_logger.IsEnabled(LogLevel.Information))
{ {
if (_logger.IsEnabled(LogLevel.Information)) _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
{
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
}
await Task.Delay(_options.IntervalInMillisecond, context.CancellationToken);
} }
await Task.Delay(_options.IntervalInMillisecond, context.CancellationToken);
} }
} }
} }