Пример #1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                _logger.LogInformation("Serviço rodando às: {time}", DateTimeOffset.Now);

                _serviceProvider
                .CreateScope()
                .ServiceProvider.GetService <IImpressaoAplicacao>()
                .Processar();

                var tempo = Configuracao.ObterConfiguracao <int>("Tempo");
                await Task.Delay(tempo, stoppingToken);
            }
        }