From 05b771badb7dddfa2f5132cc7a72fc2544d22cce Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 7 Apr 2026 12:34:41 +0200 Subject: [PATCH] Fix commento xu stop dati storici --- MP.IOC/Services/MetricsDbFlushService.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/MP.IOC/Services/MetricsDbFlushService.cs b/MP.IOC/Services/MetricsDbFlushService.cs index 66e05e77..bb5e5b4f 100644 --- a/MP.IOC/Services/MetricsDbFlushService.cs +++ b/MP.IOC/Services/MetricsDbFlushService.cs @@ -61,13 +61,13 @@ namespace MP.IOC.Services { try { - var deleteConfirmed = _config.GetValue("RouteMan:RecoverHistoricalMetrics", false); + //var deleteConfirmed = _config.GetValue("RouteMan:RecoverHistoricalMetrics", false); - if (!deleteConfirmed) - { - Log.Debug("Historical metrics recovery disabled, skipping"); - return; - } + //if (!deleteConfirmed) + //{ + // Log.Debug("Historical metrics recovery disabled, skipping"); + // return; + //} Log.Info("Starting historical metrics recovery from Redis..."); @@ -133,6 +133,8 @@ namespace MP.IOC.Services if (recordsToInsert.Count > 0) { + await using var scope = _scopeFactory.CreateAsyncScope(); + var _aggrService = scope.ServiceProvider.GetRequiredService(); await _aggrService.UpsertManyAsync(recordsToInsert, false); Log.Info("[HISTORICAL] Recovered {count} hourly records for method {method}", recordsToInsert.Count, method); @@ -189,6 +191,8 @@ namespace MP.IOC.Services if (recordsToInsert.Count > 0) { + await using var scope = _scopeFactory.CreateAsyncScope(); + var _detailService = scope.ServiceProvider.GetRequiredService(); await _detailService.UpsertManyAsync(recordsToInsert, false); Log.Info("[HISTORICAL] Recovered {count} daily records for method {method}", recordsToInsert.Count, method);