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);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Report about task logic error
 /// </summary>
 public static void LogicError(this ITaskStatusService srv, Exception e)
 {
     srv.LogicError(new StatusError(e));
 }