This commit is contained in:
Samuele E. Locatelli (W11-AI)
2026-04-07 11:27:18 +02:00
6 changed files with 25 additions and 13 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 6.16.2604.710</h4>
<h4>Versione: 6.16.2604.711</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2604.710
6.16.2604.711
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2604.710</version>
<version>6.16.2604.711</version>
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+10 -9
View File
@@ -72,21 +72,22 @@ namespace MP.IOC.Services
var taskZAddHour = batch.SortedSetAddAsync(hoursIndex, hourKey, hourScore);
var taskZAddDay = batch.SortedSetAddAsync(daysIndex, dayKey, dayScore);
// Optionally set TTL on bucket hashes (e.g., keep daily buckets 400 days)
var taskExpireHour = batch.KeyExpireAsync(hourKey, TimeSpan.FromDays(11)); // keep ~11 days for hourly
var taskExpireDay = batch.KeyExpireAsync(dayKey, TimeSpan.FromDays(400)); // keep ~400 days for daily
//// Optionally set TTL on bucket hashes (e.g., keep daily buckets 400 days)
//var taskExpireHour = batch.KeyExpireAsync(hourKey, TimeSpan.FromDays(11)); // keep ~11 days for hourly
//var taskExpireDay = batch.KeyExpireAsync(dayKey, TimeSpan.FromDays(400)); // keep ~400 days for daily
// Execute batch
batch.Execute();
// Await tasks to ensure completion
await Task.WhenAll(taskHourCount, taskHourTotal, taskDayCount, taskDayTotal,
taskZAddHour, taskZAddDay, taskExpireHour, taskExpireDay);
await Task.WhenAll(taskHourCount, taskHourTotal, taskDayCount, taskDayTotal, taskZAddHour, taskZAddDay);
//await Task.WhenAll(taskHourCount, taskHourTotal, taskDayCount, taskDayTotal,
// taskZAddHour, taskZAddDay, taskExpireHour, taskExpireDay);
// Trim indices to keep only last N entries (use ZREMRANGEBYRANK)
// Note: trimming is separate calls (not in batch) to ensure ordering; can be batched too.
await _db.SortedSetRemoveRangeByRankAsync(hoursIndex, 0, -MaxHourlyBuckets - 1); // keep last MaxHourlyBuckets
await _db.SortedSetRemoveRangeByRankAsync(daysIndex, 0, -MaxDailyBuckets - 1);
//// Trim indices to keep only last N entries (use ZREMRANGEBYRANK)
//// Note: trimming is separate calls (not in batch) to ensure ordering; can be batched too.
//await _db.SortedSetRemoveRangeByRankAsync(hoursIndex, 0, -MaxHourlyBuckets - 1); // keep last MaxHourlyBuckets
//await _db.SortedSetRemoveRangeByRankAsync(daysIndex, 0, -MaxDailyBuckets - 1);
}
_stats.Clear();
+1 -1
View File
@@ -81,7 +81,7 @@ namespace MP.IOC.Services
var (oldW, newW) = _weightProvider.GetWeightsFor(metodo);
var pickNew = DecideByWeights(oldW, newW);
var target = pickNew ? "new" : "old";
var target = pickNew ? "IOC" : "IO";
// Costruisci destination base in base al target
var destBase = pickNew
+11
View File
@@ -8,6 +8,8 @@ namespace MP.IOC.Services
{
public long Count;
public TimeSpan TotalDuration = TimeSpan.Zero;
public TimeSpan MaxDuration = TimeSpan.Zero;
public TimeSpan MinDuration = TimeSpan.MaxValue;
public ConcurrentDictionary<string, long> Destinations = new();
public ConcurrentDictionary<int, long> StatusCodes = new();
}
@@ -30,6 +32,15 @@ namespace MP.IOC.Services
lock (stat)
{
stat.TotalDuration += duration;
// aggiorno valori min/max se necessario
if (stat.MaxDuration < duration)
{
stat.MaxDuration = duration;
}
if (stat.MinDuration > duration)
{
stat.MinDuration = duration;
}
}
}
}