Exemplo n.º 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
				}
			}
		}
Exemplo n.º 2
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
                }
            }
        }