/// <summary> /// Gets the egm data for report. /// </summary> /// <param name="timer">The timer.</param> /// <param name="o">The o.</param> private void GetEgmDataForReport(Timer timer, object o) { var casinoDataReport = DataAggregator.GetCasinoDataReport(); if (null == casinoDataReport) { return; } // Guard against Timer event re-entrancy by breaking out of // data processing do...while loop (below) when we are approaching // next Timer event (even if there is more data to process). var startAt = DateTime.UtcNow; var reentrantGuardMinutes = Settings.Default.CloudReportInterval * 0.10d; if (ReentrantGuardMaxMinutes < reentrantGuardMinutes) { reentrantGuardMinutes = ReentrantGuardMaxMinutes; } var reentrantGuardTimeSpan = TimeSpan.FromMinutes(Settings.Default.CloudReportInterval) .Subtract(TimeSpan.FromMinutes(reentrantGuardMinutes)); do { Logger.Debug($"Casino Data Report {casinoDataReport}"); try { DataExporter.SendCasinoDataReport(casinoDataReport); } catch (Exception ex) { Logger.Warn( $"An unexpected error occurred while calling DataReporter.SendCasinoDataReport. Check WCF HMS configuration: [{ex.Message}]"); var innerEx = ex.InnerException; while (null != innerEx) { Logger.Warn($"[{innerEx.Message}]"); innerEx = innerEx.InnerException; } DataAggregator.UnsuccessfulCasinoDataReport(casinoDataReport.ReportGuid); Logger.Warn($"Stack Trace: [{Environment.StackTrace}]"); break; } casinoDataReport = DataAggregator.GetCasinoDataReport(); } while (null != casinoDataReport && DateTime.UtcNow.Subtract(startAt) < reentrantGuardTimeSpan); }