示例#1
0
		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
				}
			}
		}
示例#2
0
		public Report AddReport(Report report)
		{
			Reports.Add(report);

			return report;
		}
示例#3
0
        public Report AddReport(Report report)
        {
            Reports.Add(report);

            return(report);
        }