public void DoStuff() { var quary = new DashboardQuery <DailyStatsQuery>() { Options = new ObjectAnnotation.QueryOptions() { Filter = new ObjectAnnotation.Filters.Filter() { AreaType = new ObjectAnnotation.Filters.AreaType(Common.AreaTypeMetrics.overview) }, } }; var result = quary.DoQuery(); }
QueryResponce <T> IQueryEngine <T> .DoQuery() { var retries = ConfigOptions.DashboardRetries; DashboardQuery.Options = Options; for (var i = 1; i <= retries; i++) { try { Logger.LogInformation($"Qerying dashboard. Making attempt {i} of {retries}."); var result = DashboardQuery.DoQuery(); Logger.LogInformation("Successfully queried dashboard."); return(result); } catch (Exception ex) { if (i < retries) { Logger.LogWarning(ex, $"Problem querying dashboard."); var pauseBeforeRetry = true; if (pauseBeforeRetry) { Logger.LogWarning($"Pausing before retry."); Thread.Sleep(10000); } Logger.LogWarning($" Retrying..."); } else { Logger.LogError(ex, $"Problem querying dashboard. Retries exceeded. Skipping query."); // throw new Exception("Fatal Failure in achive"); } } } return(DashboardQuery.GetEmptyQuery()); }