Ejemplo n.º 1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                try
                {
                    _statusService.LogicStarted();
                    await _logic.Perform(stoppingToken);

                    _statusService.LogicCompleted();
                }
                catch (Exception e)
                {
                    _statusService.LogicError(e);
                    _log?.Error("Error when perform task logic", e).Write();
                }

                await Task.Delay(_period, stoppingToken);
            }
        }