conf parametri pulizia log redis da .config
This commit is contained in:
+48
-3
@@ -92,6 +92,21 @@ namespace SteamWare
|
||||
/// </summary>
|
||||
protected int _logMaxMb;
|
||||
|
||||
/// <summary>
|
||||
/// max numero di veto count da accettare
|
||||
/// </summary>
|
||||
protected int _vetoRedisCheckLimit = 100;
|
||||
|
||||
/// <summary>
|
||||
/// max numero di veto count da accettare
|
||||
/// </summary>
|
||||
protected int _vetoRedisPausePurge = 20;
|
||||
|
||||
/// <summary>
|
||||
/// max numero di key da eliminare ogni check
|
||||
/// </summary>
|
||||
protected int _vetoRedisPurgeMax = 200;
|
||||
|
||||
/// <summary>
|
||||
/// Indica se sia abilitato log diagnostico esteso...
|
||||
/// </summary>
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
<add key="cacheOnRedis" value="true" />
|
||||
<add key="redisDb" value="1" />
|
||||
<add key="_logDir" value="./logs/" />
|
||||
<add key="vetoRedisCheckLimit" value="100" />
|
||||
<add key="vetoRedisPausePurge" value="10" />
|
||||
<add key="vetoRedisPurgeMax" value="300" />
|
||||
<add key="codModulo" value="TestBench" />
|
||||
<add key="DbConfConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=TestBench;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
|
||||
</appSettings>
|
||||
|
||||
Reference in New Issue
Block a user