public async Task RunReportAsync(Report report) { while (true) { try { //estimate report generation time to correct interval between runnings var stopwatch = new Stopwatch(); stopwatch.Start(); await report.ExecuteAsync(); stopwatch.Stop(); Trace.WriteLine(stopwatch.Elapsed); await CoreEx.DelayIfNeeded(report.RunInterval, stopwatch.Elapsed); } catch (Exception exception) { var minutes = TimeSpan.FromMinutes(10); await SystemLogRepository.SaveAsync(exception, $"Unhandled report error. Report will be recycled in {minutes}. "); await Task.Delay(minutes); //TODO to config } } }
public Report AddReport(Report report) { Reports.Add(report); return report; }
public Report AddReport(Report report) { Reports.Add(report); return(report); }