Ancora minor fix performances...

This commit is contained in:
Samuele Locatelli
2026-04-17 09:12:56 +02:00
parent cf060cc387
commit 74ead47e3f
7 changed files with 17 additions and 52 deletions
+3 -4
View File
@@ -810,20 +810,19 @@ namespace MP.IOC.Controllers
// Multi: gestione carattere "|" trasformato in "#"
id = id.Replace("|", "#");
string answ = "";
Dictionary<string, string> valori = new();
try
{
await DService.ScriviKeepAliveAsync(id, DateTime.Now);
// leggo da REDIS eventuale elenco task x macchina...
Dictionary<string, string> valori = await DService.GetTask2ExeMacchinaAsync(id);
answ = JsonConvert.SerializeObject(valori);
valori = await DService.GetTask2ExeMacchinaAsync(id);
}
catch (Exception exc)
{
Log.Error($"Errore in GetTask2Exe{Environment.NewLine}{exc}");
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
}
return Ok(answ);
return Ok(valori);
}
/// <summary>
+8 -42
View File
@@ -1682,19 +1682,8 @@ namespace MP.IOC.Data
/// <returns></returns>
public async Task<Dictionary<string, string>> GetTask2ExeMacchinaAsync(string idxMacchina)
{
// hard coded dimensione vettore DatiMacchine
Dictionary<string, string> answ = new Dictionary<string, string>();
// ORA recupero da memoria redis...
try
{
var currHash = Utils.RedKeyTask2ExeMacc(idxMacchina, MpIoNS);
answ = await RedisGetHashDictAsync(currHash);
}
catch (Exception exc)
{
Log.Info(string.Format("Errore in GetTask2ExeMacchinaAsync | idxMacchina {2}:{0}{1}", Environment.NewLine, exc, idxMacchina));
}
return answ;
var currHash = Utils.RedKeyTask2ExeMacc(idxMacchina, MpIoNS);
return await RedisGetHashDictAsync(currHash);
}
/// <summary>
@@ -3560,17 +3549,7 @@ namespace MP.IOC.Data
public async Task<bool> RedisKeyPresentAsync(RedisKey key)
{
bool result = false;
try
{
result = await redisDb.KeyExistsAsync(key);
}
catch (Exception arg)
{
Log.Error($"Errore in redKeyPresent per la currKey {key}:{Environment.NewLine}{arg}");
}
return result;
return await redisDb.KeyExistsAsync(key);
}
public bool RedisKeyPresentSz(string key)
@@ -4129,29 +4108,16 @@ namespace MP.IOC.Data
{
string nomeVar = string.Format("KeepAlive:{0}", IdxMacchina);
// cerco se ho keep alive in redis,
bool keyPresent = false;
DateTime adesso = DateTime.Now;
var currKey = Utils.RedKeyHash(nomeVar);
try
{
keyPresent = await RedisKeyPresentAsync(currKey);
}
catch
{ }
bool keyPresent = await RedisKeyPresentAsync(currKey);
// se NON presente salvo in REDIS con TTL 10 sec e sul DB...
if (!keyPresent)
{
await redisDb.StringSetAsync(currKey, adesso.ToString("s"), TimeSpan.FromSeconds(10));
try
{
Log.Trace($"Scrittura keep alive! IdxMacchina: {IdxMacchina}");
// effettuo scrittura sul DB
await IocDbController.KeepAliveUpsertAsync(IdxMacchina, DateTime.Now, oraMacchina);
}
catch (Exception exc)
{
Log.Error($"Errore in scrittura keep alive!{Environment.NewLine}oraMacchina: {oraMacchina} - IdxMacchina: {IdxMacchina}{Environment.NewLine}{exc}");
}
await redisDb.StringSetAsync(currKey, adesso.ToString("s"), TimeSpan.FromSeconds(20));
Log.Trace($"Scrittura keep alive! IdxMacchina: {IdxMacchina}");
// effettuo scrittura sul DB
await IocDbController.KeepAliveUpsertAsync(IdxMacchina, DateTime.Now, oraMacchina);
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>6.16.2604.1708</Version>
<Version>6.16.2604.1709</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 6.16.2604.1708</h4>
<h4>Versione: 6.16.2604.1709</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2604.1708
6.16.2604.1709
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2604.1708</version>
<version>6.16.2604.1709</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>
+2 -2
View File
@@ -15,10 +15,10 @@
],
"Clusters": {
"cluster-old": {
"Destinations": { "old1": { "Address": "https://iis01.egalware.com/MP/IO/IOB/" } }
"Destinations": { "old1": { "Address": "https://maposrv.egalware.com/MP/IO/IOB/" } }
},
"cluster-new": {
"Destinations": { "new1": { "Address": "https://iis01.egalware.com/MP/IOC/api/IOB/" } }
"Destinations": { "new1": { "Address": "https://maposrv.egalware.com/MP/IOC/api/IOB/" } }
}
}
},