Messo TTL x dati statistiche a 30gg max
This commit is contained in:
@@ -115,7 +115,7 @@ namespace MP.RIOC.Services
|
||||
// Calcolo NoReply: Somma di tutti i codici >= 400 o errori espliciti
|
||||
long noReplyCount = stat.ErrorMessages.Sum(x => x.Value);
|
||||
|
||||
// 1. INVIO BUCKET PRINCIPALE (con NoReply)
|
||||
// 1. INVIO BUCKET PRINCIPALE (con NoReply)
|
||||
// Usiamo lo script Lua per l'aggiornamento atomico dell'ora
|
||||
tasks.Add(batch.ScriptEvaluateAsync(_updateScript,
|
||||
new RedisKey[] { hourKey },
|
||||
@@ -128,10 +128,15 @@ namespace MP.RIOC.Services
|
||||
SentinelValue
|
||||
}));
|
||||
|
||||
// 1b. Imposta TTL 30 giorni su bucket hourly per prevenire chiavi orfane
|
||||
tasks.Add(batch.KeyExpireAsync(hourKey, TimeSpan.FromDays(30)));
|
||||
|
||||
// 2. INVIO DISTRIBUZIONE STATUS CODES
|
||||
if (stat.StatusCodes.Any())
|
||||
{
|
||||
var statusKey = hourKey + ":status";
|
||||
// Imposta TTL 30 giorni su chiavi ausiliarie per prevenire chiavi orfane
|
||||
tasks.Add(batch.KeyExpireAsync(statusKey, TimeSpan.FromDays(30)));
|
||||
foreach (var status in stat.StatusCodes)
|
||||
{
|
||||
tasks.Add(batch.HashIncrementAsync(statusKey, status.Key.ToString(), status.Value));
|
||||
@@ -144,6 +149,8 @@ namespace MP.RIOC.Services
|
||||
if (stat.ErrorMessages.Any())
|
||||
{
|
||||
var errorKey = hourKey + ":errors";
|
||||
// Imposta TTL 30 giorni su chiavi ausiliarie per prevenire chiavi orfane
|
||||
tasks.Add(batch.KeyExpireAsync(errorKey, TimeSpan.FromDays(30)));
|
||||
foreach (var error in stat.ErrorMessages)
|
||||
{
|
||||
// Usiamo HashIncrement per aggregare messaggi uguali
|
||||
@@ -174,6 +181,9 @@ namespace MP.RIOC.Services
|
||||
|
||||
// Aggiungiamo l'indice al batch
|
||||
tasks.Add(batch.SortedSetAddAsync(daysIndex, dayKey, dayScore));
|
||||
|
||||
// 5. Imposta TTL 30 giorni su chiave daily per prevenire chiavi orfane
|
||||
tasks.Add(batch.KeyExpireAsync(dayKey, TimeSpan.FromDays(30)));
|
||||
}
|
||||
|
||||
// --- INVIO AGGREGATI DAILY A REDIS ---
|
||||
|
||||
@@ -2198,6 +2198,7 @@ namespace MP.SPEC.Data
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache dato singolo tag
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> FlushFusionCacheAsync(string tag)
|
||||
{
|
||||
@@ -2211,6 +2212,7 @@ namespace MP.SPEC.Data
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache dato elenco tags
|
||||
/// </summary>
|
||||
/// <param name="listTags"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> FlushFusionCacheAsync(List<string> listTags)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user