Completata pèulizia SPEC!!!
This commit is contained in:
@@ -187,7 +187,7 @@ namespace MP.SPEC.Data
|
||||
using var activity = ActivitySource.StartActivity("AnagGruppiDeleteAsync");
|
||||
bool result = false;
|
||||
string source = "DB";
|
||||
result = dbController.AnagGruppiDelete(updRec);
|
||||
result = await dbController.AnagGruppiDeleteAsync(updRec);
|
||||
// elimino cache redis...
|
||||
await FlushFusionCacheAsync(Utils.redisAnagGruppi);
|
||||
activity?.SetTag("data.source", source);
|
||||
@@ -206,7 +206,7 @@ namespace MP.SPEC.Data
|
||||
using var activity = ActivitySource.StartActivity("AnagGruppiUpsertAsync");
|
||||
bool result = false;
|
||||
string source = "DB";
|
||||
result = dbController.AnagGruppiUpsert(UpdRec);
|
||||
result = await dbController.AnagGruppiUpsertAsync(UpdRec);
|
||||
// elimino cache redis...
|
||||
await FlushFusionCacheAsync(Utils.redisAnagGruppi);
|
||||
activity?.SetTag("data.source", source);
|
||||
@@ -252,7 +252,7 @@ namespace MP.SPEC.Data
|
||||
operationName: "ArticleWithDossierAsync",
|
||||
cacheKey: Utils.redisArtByDossier,
|
||||
expiration: GetRandTOut(redisLongTimeCache),
|
||||
fetchFunc: async () => await Task.FromResult(dbController.ArticleWithDossier()) ?? new List<string>(),
|
||||
fetchFunc: async () => await dbController.ArticleWithDossierAsync() ?? new List<string>(),
|
||||
tagList: [Utils.redisArtByDossier]
|
||||
);
|
||||
}
|
||||
@@ -285,13 +285,13 @@ namespace MP.SPEC.Data
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ArticoliDeleteRecord(AnagArticoliModel currRec)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("ArticoliDeleteRecord");
|
||||
using var activity = ActivitySource.StartActivity("ArticoliDeleteRecordAsync");
|
||||
string source = "DB";
|
||||
bool fatto = await dbController.ArticoliDeleteRecord(currRec);
|
||||
bool fatto = await dbController.ArticoliDeleteRecordAsync(currRec);
|
||||
await FlushFusionCacheArticoli();
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"ArticoliDeleteRecord | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"ArticoliDeleteRecordAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
@@ -868,16 +868,16 @@ namespace MP.SPEC.Data
|
||||
/// <param name="minAvgFrag">def: 10</param>
|
||||
/// <param name="maxAvgFragReb">def: 50</param>
|
||||
/// <returns></returns>
|
||||
public async Task ForceDbMaint(bool doExec = true, bool doUpdStat = true, bool doSave = true, int minPgCnt = 1000, int minAvgFrag = 10, int maxAvgFragReb = 50)
|
||||
public async Task ForceDbMaintAsync(bool doExec = true, bool doUpdStat = true, bool doSave = true, int minPgCnt = 1000, int minAvgFrag = 10, int maxAvgFragReb = 50)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("ForceDbMaint");
|
||||
using var activity = ActivitySource.StartActivity("ForceDbMaintAsync");
|
||||
string source = "DB";
|
||||
await dbController.ForceDbMaint(doExec, doUpdStat, doSave, minPgCnt, minAvgFrag, maxAvgFragReb);
|
||||
await dbController.ForceDbMaintAsync(doExec, doUpdStat, doSave, minPgCnt, minAvgFrag, maxAvgFragReb);
|
||||
// svuoto cache
|
||||
await FlushFusionCacheFluxLog();
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"ForceDbMaint | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"ForceDbMaintAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
// registro statistiche esecuzione
|
||||
await RecDbMaintStatAsync(activity?.Duration ?? TimeSpan.FromSeconds(1));
|
||||
}
|
||||
@@ -1494,7 +1494,7 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("POdlDeleteRecord");
|
||||
string source = "DB+REDIS";
|
||||
var dbResult = await dbController.PODLDeleteRecord(currRec);
|
||||
var dbResult = await dbController.PODLDeleteRecordAsync(currRec);
|
||||
// elimino cache redis...
|
||||
await FlushFusionCachePOdl();
|
||||
activity?.SetTag("data.source", source);
|
||||
@@ -1740,65 +1740,6 @@ namespace MP.SPEC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua conteggio chaivi REDIS dato pat2Flush ricerca
|
||||
/// </summary>
|
||||
/// <param name="keyPattern"></param>
|
||||
/// <returns></returns>
|
||||
public int RedisCountKey(string keyPattern)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("RedisCountKey");
|
||||
string source = "REDIS";
|
||||
int num = 0;
|
||||
keyPattern = (string.IsNullOrEmpty(keyPattern) ? "**" : keyPattern);
|
||||
try
|
||||
{
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
foreach (RedisKey item in server.Keys(pattern: keyPattern, database: redisDb.Database, pageSize: 250, cursor: 0L))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception arg)
|
||||
{
|
||||
Log.Error($"Eccezione in RedisCountKey{Environment.NewLine}{arg}");
|
||||
}
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"RedisCountKey | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue eliminazione memoria redis keyVal
|
||||
/// </summary>
|
||||
/// <param name="keyVal"></param>
|
||||
/// <returns></returns>
|
||||
public bool RedisDelKey(string keyVal)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("RedisDelKey");
|
||||
string source = "REDIS";
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
redisDb.KeyDelete((RedisKey)keyVal);
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"RedisDelKey | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset della cache IO post operazioni come setup ODL...
|
||||
/// </summary>
|
||||
@@ -1887,7 +1828,7 @@ namespace MP.SPEC.Data
|
||||
string source = "DB";
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.TemplateKitUpsert(currRecord, codAzienda);
|
||||
fatto = await dbController.TemplateKitUpsertAsync(currRecord, codAzienda);
|
||||
await FlushFusionCacheAsync(Utils.redisKitTempl);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
|
||||
Reference in New Issue
Block a user