refactor(kpi): K13/K15 trend review fixups — per-metric isolation, disable-during-load + logging, loading-flag finally, test coverage
This commit is contained in:
+19
-11
@@ -585,18 +585,26 @@ public partial class SiteCallsReport
|
||||
private async Task LoadTrendsAsync()
|
||||
{
|
||||
_trendsLoading = true;
|
||||
try
|
||||
{
|
||||
var toUtc = DateTime.UtcNow;
|
||||
var fromUtc = toUtc - TimeSpan.FromHours(_windowHours);
|
||||
|
||||
var toUtc = DateTime.UtcNow;
|
||||
var fromUtc = toUtc - TimeSpan.FromHours(_windowHours);
|
||||
|
||||
(_bufferedSeries, _bufferedAvailable, _bufferedError) =
|
||||
await LoadSeriesAsync("buffered", fromUtc, toUtc);
|
||||
(_parkedSeries, _parkedAvailable, _parkedError) =
|
||||
await LoadSeriesAsync("parked", fromUtc, toUtc);
|
||||
(_failedSeries, _failedAvailable, _failedError) =
|
||||
await LoadSeriesAsync("failedLastInterval", fromUtc, toUtc);
|
||||
|
||||
_trendsLoading = false;
|
||||
(_bufferedSeries, _bufferedAvailable, _bufferedError) =
|
||||
await LoadSeriesAsync("buffered", fromUtc, toUtc);
|
||||
(_parkedSeries, _parkedAvailable, _parkedError) =
|
||||
await LoadSeriesAsync("parked", fromUtc, toUtc);
|
||||
(_failedSeries, _failedAvailable, _failedError) =
|
||||
await LoadSeriesAsync("failedLastInterval", fromUtc, toUtc);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// try/finally so an unexpected throw before this line can't lock the
|
||||
// spinner/disabled state on forever. The per-metric LoadSeriesAsync
|
||||
// try/catches already swallow GetSeriesAsync failures, so this guards
|
||||
// only the truly unexpected.
|
||||
_trendsLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user