diff --git a/SteamWareLib/logger.cs b/SteamWareLib/logger.cs index 160bcf5..5ba11e5 100644 --- a/SteamWareLib/logger.cs +++ b/SteamWareLib/logger.cs @@ -92,6 +92,21 @@ namespace SteamWare /// protected int _logMaxMb; + /// + /// max numero di veto count da accettare + /// + protected int _vetoRedisCheckLimit = 100; + + /// + /// max numero di veto count da accettare + /// + protected int _vetoRedisPausePurge = 20; + + /// + /// max numero di key da eliminare ogni check + /// + protected int _vetoRedisPurgeMax = 200; + /// /// Indica se sia abilitato log diagnostico esteso... /// @@ -137,6 +152,34 @@ namespace SteamWare { enableDumpDiag = false; } + // imposto i parametri per la pulizia dei veto su Redis + try + { + if (!string.IsNullOrEmpty(memLayer.ML.CRS("vetoRedisCheckLimit"))) + { + _vetoRedisCheckLimit = memLayer.ML.CRI("vetoRedisCheckLimit"); + } + } + catch + { } + try + { + if (!string.IsNullOrEmpty(memLayer.ML.CRS("vetoRedisPausePurge"))) + { + _vetoRedisPausePurge = memLayer.ML.CRI("vetoRedisPausePurge"); + } + } + catch + { } + try + { + if (!string.IsNullOrEmpty(memLayer.ML.CRS("vetoRedisPurgeMax"))) + { + _vetoRedisPurgeMax = memLayer.ML.CRI("vetoRedisPurgeMax"); + } + } + catch + { } // all'avvio imposto ultimo check a 23 ore fa... così farà shrink DOPO 1 h da avvio lastDirCheck = DateTime.Now.AddHours(-23); } @@ -210,19 +253,21 @@ namespace SteamWare private void purgeOldVeto() { // limite minimo di chaivi salvate per cui procedere coi controlli - int checkLimit = 100; + int checkLimit = _vetoRedisCheckLimit; // limito cleanup x avere un operazione graduale... - int maxCleanup = checkLimit * 2; + int maxCleanup = _vetoRedisPurgeMax; // parto recuperando i valori VETO.... se > 100... string redKeyCounters = memLayer.ML.redHash("Logger:Counter:*"); string redLastCheck = memLayer.ML.redHash("Logger:CheckLock"); // se non ho un veto check... if (string.IsNullOrEmpty(memLayer.ML.getRSV(redLastCheck))) { - memLayer.ML.setRSV(redLastCheck, "LOCK", 5); + memLayer.ML.setRSV(redLastCheck, "LOCK", _vetoRedisPausePurge); int numCount = memLayer.ML.redCountKey(redKeyCounters); if (numCount > checkLimit) { + // se necessario riduco valore maxCleanup --> checkLimit... + maxCleanup = numCount < maxCleanup ? checkLimit : maxCleanup; var redKeysList2check = memLayer.ML.redGetKeys(redKeyCounters); foreach (var item in redKeysList2check) { diff --git a/TestBench/App.config b/TestBench/App.config index 1f944e5..20de6e5 100644 --- a/TestBench/App.config +++ b/TestBench/App.config @@ -10,6 +10,9 @@ + + +