diff --git a/MP.RIOC/Services/MetricsDbFlushService.cs b/MP.RIOC/Services/MetricsDbFlushService.cs index d90a1dd9..56510506 100644 --- a/MP.RIOC/Services/MetricsDbFlushService.cs +++ b/MP.RIOC/Services/MetricsDbFlushService.cs @@ -114,6 +114,7 @@ namespace MP.RIOC.Services } } +#if false /// /// Recupera il TTL residuo di una chiave Redis (-1 = nessun TTL, -2 = chiave non esiste) /// @@ -124,7 +125,8 @@ namespace MP.RIOC.Services return _db.KeyTimeToLive(key); } catch { return null; } - } + } +#endif /// /// Processing dati giornalieri (da Redis a DB) @@ -174,18 +176,19 @@ namespace MP.RIOC.Services if (!TryParseKeyMetadata(sKey, out var meta) || meta.IsHourType) continue; // Verifica se la chiave è "orfana" + bool isOrphanKey = meta.Timestamp < currentDayStart; +#if false bool isOrphanKey = false; var keyTtl = GetKeyTtl(sKey); if (keyTtl == null) { - // Nessun TTL recuperato = chiave senza scadenza = orfana se > 30 gg - DateTime cutoffDay = DateTime.Today.AddDays(-30); - isOrphanKey = meta.Timestamp < cutoffDay; + isOrphanKey = meta.Timestamp < currentDayStart; } else { isOrphanKey = keyTtl.Value.TotalSeconds < 0 || keyTtl.Value.TotalDays < 1; - } + } +#endif // Se è orfana e abbiamo il permesso, segnamola per la cancellazione // NOTA: non usiamo il confronto con currentDayStart perché taglierebbe fuori @@ -326,6 +329,8 @@ namespace MP.RIOC.Services if (!TryParseKeyMetadata(sKey, out var meta) || !meta.IsHourType) continue; // Verifica se la chiave è "orfana" + bool isOrphanKey = meta.Timestamp < currentHourStart; +#if false bool isOrphanKey = false; var keyTtl = GetKeyTtl(sKey); if (keyTtl == null) @@ -337,7 +342,8 @@ namespace MP.RIOC.Services else { isOrphanKey = keyTtl.Value.TotalSeconds < 0 || keyTtl.Value.TotalDays < 15; - } + } +#endif // Se è orfana e abbiamo il permesso, segnamola per la cancellazione // NOTA: non usiamo il confronto con currentHourStart perché taglierebbe fuori