From 23e7055ecafcd81bc7fdeacd7dcb6a811ab04abc Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 17 Dec 2025 08:23:27 +0100 Subject: [PATCH] Update con close iniziale calcoli completati --- EgwCoreLib.Lux.Data/Services/CalcRuidService.cs | 2 +- EgwCoreLib.Lux.Data/Services/StatsCollectService.cs | 5 ++++- Lux.API/appsettings.json | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs b/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs index 25fe3890..ca77d46b 100644 --- a/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs +++ b/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs @@ -224,7 +224,7 @@ namespace EgwCoreLib.Lux.Data.Services // Cancello hash delle statistiche aggregate tasks.Add(batch.KeyDeleteAsync(Key(aggKeyStr))); // Rimuovo dall’indice - tasks.Add(batch.SetRemoveAsync(Key("stats:agg:index"), (RedisValue)$"{aggKeyStr}")); + tasks.Add(batch.SetRemoveAsync(Key("stats:agg:index"), (RedisValue)$"{hourStr}")); // Cancello hash delle richieste per la stessa ora tasks.Add(batch.KeyDeleteAsync(Key(reqKeyStr))); diff --git a/EgwCoreLib.Lux.Data/Services/StatsCollectService.cs b/EgwCoreLib.Lux.Data/Services/StatsCollectService.cs index c75989b6..d2e76525 100644 --- a/EgwCoreLib.Lux.Data/Services/StatsCollectService.cs +++ b/EgwCoreLib.Lux.Data/Services/StatsCollectService.cs @@ -21,6 +21,7 @@ namespace EgwCoreLib.Lux.Data.Services try { reqPeriodMinute = _config.GetValue("ServerConf:CleanupPeriodMinutes"); + clearProcessed = _config.GetValue("ServerConf:CleanupProcessed"); } catch { @@ -31,13 +32,15 @@ namespace EgwCoreLib.Lux.Data.Services #endregion Public Constructors + private bool clearProcessed = false; + #region Protected Methods protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { - await _calcRuidService.ExportStatsToDbAsync(false); + await _calcRuidService.ExportStatsToDbAsync(clearProcessed); // attesa tra le esecuzioni await Task.Delay(TimeSpan.FromMinutes(reqPeriodMinute), stoppingToken); diff --git a/Lux.API/appsettings.json b/Lux.API/appsettings.json index 575e1a16..3057a94b 100644 --- a/Lux.API/appsettings.json +++ b/Lux.API/appsettings.json @@ -74,6 +74,7 @@ "FileSharePath": "\\\\stor01\\TEAM DRIVES\\40_FileUpload\\LuxUploads", "RedisBaseKey": "Lux", "CleanupPeriodMinutes": 30, + "CleanupProcessed": true, "CleanupDayTTL": 180 } }