Fix gestione cache TaskMan che andava a collidere

This commit is contained in:
Samuele Locatelli
2024-10-31 12:57:26 +01:00
parent 62fd1d0ab2
commit c56d25139d
10 changed files with 40 additions and 31 deletions
+2 -1
View File
@@ -76,6 +76,7 @@
"AppUrl": "/MP/LAND",
"TaskManConn": "MP.Land",
"CodApp": "MP-LAND",
"CodModulo": "MP-LAND"
"CodModulo": "MP-LAND",
"RedisBaseConf": "MP:TASK:LAND"
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Prog</RootNamespace>
<Version>6.16.2410.3110</Version>
<Version>6.16.2410.3112</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 6.16.2410.3110</h4>
<h4>Versione: 6.16.2410.3112</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2410.3110
6.16.2410.3112
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2410.3110</version>
<version>6.16.2410.3112</version>
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+2 -1
View File
@@ -66,6 +66,7 @@
"AppUrl": "/MP/PROG",
"TaskManConn": "MP.Prog",
"CodApp": "MP-PROG",
"CodModulo": "MP-PROG"
"CodModulo": "MP-PROG",
"RedisBaseConf": "MP:TASK:PROG"
}
}
+2 -1
View File
@@ -58,7 +58,8 @@
"FormatDur": "HH:mm.ss.ff",
"SpecialConf": {
"AppUrl": "/MP/STATS",
"TaskManConn": "MP.Stats"
"TaskManConn": "MP.Stats",
"RedisBaseConf": "MP:TASK:STATS"
},
"ServerConf": {
"Prog.ApiUrl": "https://localhost/MP/STATS"
+10 -4
View File
@@ -62,7 +62,13 @@ namespace MP.TaskMan.Services
// sistemo
DataSource = connStrParams["Server"];
DataBase = connStrParams["Database"];
RedisBaseKey= $"MP:TaskMan:{DataSource}:{DataBase}";
string rbc = _configuration.GetValue<string>("SpecialConf:RedisBaseConf");
if (string.IsNullOrEmpty(rbc))
{
rbc = "MP:TaskMan";
}
RedisBaseKey = $"{rbc}:{DataSource}:{DataBase}";
}
// conf rest call service
@@ -207,7 +213,7 @@ namespace MP.TaskMan.Services
List<TaskExecModel> result = new List<TaskExecModel>();
// cerco in redis...
DateTime adesso = DateTime.Now;
string currKey = $"{RedisBaseKey}:Task:ExecList:{TaskId}:{adesso:yyMMdd}:{adesso:HHmm}:{maxRec}";
string currKey = $"{RedisBaseKey}:ExecList:{TaskId}:{adesso:yyMMdd}:{adesso:HHmm}:{maxRec}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
@@ -245,7 +251,7 @@ namespace MP.TaskMan.Services
List<TaskListModel> result = new List<TaskListModel>();
// cerco in redis...
DateTime adesso = DateTime.Now;
string currKey = $"{RedisBaseKey}:Task:List:{TType}";
string currKey = $"{RedisBaseKey}:List:{TType}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
@@ -286,7 +292,7 @@ namespace MP.TaskMan.Services
bool dbResult = MLController.TaskListMove(rec2upd, moveUp);
// svuoto cache!
await FlushCache();
return await Task.FromResult(dbResult);
return dbResult;
}
/// <summary>
+11 -11
View File
@@ -16,7 +16,7 @@
}
else
{
<button class="btn btn-secondary" @onclick="doCancel" title="Cancel"><i class="fas fa-undo"></i> Cancel</button>
<button class="btn btn-secondary" @onclick="DoCancel" title="Cancel"><i class="fas fa-undo"></i> Cancel</button>
}
}
else
@@ -34,7 +34,7 @@
</div>
</div>
</div>
<TaskEdit CurrRecord="@currRecord" EC_update="forceUpdate"></TaskEdit>
<TaskEdit CurrRecord="@currRecord" EC_update="ForceUpdate"></TaskEdit>
</div>
<div class="card-body py-0 px-1">
@if (isLoading)
@@ -58,7 +58,7 @@
<thead>
<tr>
<th>
<button class="btn btn-sm btn-info" @onclick="doReset" title="Reset"><i class="fas fa-sync"></i></button>
<button class="btn btn-sm btn-info" @onclick="DoReset" title="Reset"><i class="fas fa-sync"></i></button>
</th>
<th>Ord</th>
<th>Task</th>
@@ -74,7 +74,7 @@
<th class="text-end">Next</th>
<th class="text-end">Result</th>
<th>
<button class="btn btn-sm btn-danger me-1" @onclick="forceAll" title="Force All"><i class="fas fa-play"></i></button>
<button class="btn btn-sm btn-danger me-1" @onclick="ForceAll" title="Force All"><i class="fas fa-play"></i></button>
</th>
}
</tr>
@@ -84,17 +84,17 @@
{
<tr class="@checkSelect(@record)">
<td class="text-nowrap">
<button class="btn btn-sm btn-info" @onclick="()=>doSelect(record)" title="Select"><i class="fas fa-search"></i></button>
<button class="btn btn-sm btn-info" @onclick="()=>DoSelect(record)" title="Select"><i class="fas fa-search"></i></button>
@if (detRecord == null)
{
@if (currRecord == null)
{
<button class="btn btn-sm btn-primary ms-1" @onclick="()=>doEdit(record)" title="Edit"><i class="fas fa-pencil-alt"></i></button>
<button class="btn btn-sm btn-success" @onclick="()=>doClone(record)" title="Clona"><i class="fas fa-magic"></i></button>
<button class="btn btn-sm btn-primary ms-1" @onclick="()=>DoEdit(record)" title="Edit"><i class="fas fa-pencil-alt"></i></button>
<button class="btn btn-sm btn-success" @onclick="()=>DoClone(record)" title="Clona"><i class="fas fa-magic"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary ms-1" @onclick="()=>doCancel()" title="Cancel"><i class="fas fa-undo"></i></button>
<button class="btn btn-sm btn-secondary ms-1" @onclick="()=>DoCancel()" title="Cancel"><i class="fas fa-undo"></i></button>
}
}
</td>
@@ -107,7 +107,7 @@
}
else
{
<button class="btn btn-sm btn-outline-primary mx-1" @onclick="()=>doMove(record, true)" title="Move Up"><i class="fas fa-caret-up"></i></button>
<button class="btn btn-sm btn-outline-primary mx-1" @onclick="()=>DoMove(record, true)" title="Move Up"><i class="fas fa-caret-up"></i></button>
}
}
<b>@record.Ordinal</b>
@@ -119,7 +119,7 @@
}
else
{
<button class="btn btn-sm btn-outline-primary mx-1" @onclick="()=>doMove(record, false)" title="Move Down"><i class="fas fa-caret-down"></i></button>
<button class="btn btn-sm btn-outline-primary mx-1" @onclick="()=>DoMove(record, false)" title="Move Down"><i class="fas fa-caret-down"></i></button>
}
}
</td>
@@ -154,7 +154,7 @@
<td>
@if(record.Enabled)
{
<button class="btn btn-sm @btnRunCss(record.DtNextExec) me-1" @onclick="()=>doRun(record)" title="Run Now"><i class="fas fa-play"></i></button>
<button class="btn btn-sm @btnRunCss(record.DtNextExec) me-1" @onclick="()=>DoRun(record)" title="Run Now"><i class="fas fa-play"></i></button>
}
else
{
+9 -9
View File
@@ -111,14 +111,14 @@ namespace MP.TaskMan
return answ;
}
protected async Task doCancel()
protected async Task DoCancel()
{
currRecord = null;
detRecord = null;
await ReloadData();
}
protected async Task doClone(TaskListModel selRec)
protected async Task DoClone(TaskListModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler duplicare il record selezionato?"))
return;
@@ -141,13 +141,13 @@ namespace MP.TaskMan
await ReloadData();
}
protected async Task doEdit(TaskListModel selRec)
protected async Task DoEdit(TaskListModel selRec)
{
currRecord = selRec;
await ReloadData();
}
protected async Task doMove(TaskListModel currRec, bool goUp)
protected async Task DoMove(TaskListModel currRec, bool goUp)
{
await TService.TaskListMove(currRec, goUp);
detRecord = null;
@@ -155,7 +155,7 @@ namespace MP.TaskMan
await ReloadData();
}
protected async Task doReset()
protected async Task DoReset()
{
detRecord = null;
currRecord = null;
@@ -163,7 +163,7 @@ namespace MP.TaskMan
await ReloadData();
}
protected async Task doRun(TaskListModel selRec)
protected async Task DoRun(TaskListModel selRec)
{
// SE non è ancora scaduto chiedo conferma
if (selRec.DtNextExec > DateTime.Now)
@@ -191,7 +191,7 @@ namespace MP.TaskMan
await ReloadData();
}
protected async Task doSelect(TaskListModel selRec)
protected async Task DoSelect(TaskListModel selRec)
{
detRecord = null;
currRecord = null;
@@ -202,7 +202,7 @@ namespace MP.TaskMan
isLoading = false;
}
protected async Task forceAll()
protected async Task ForceAll()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi esecuzione forzata di tutti i task?"))
return;
@@ -231,7 +231,7 @@ namespace MP.TaskMan
await ReloadData();
}
protected async Task forceUpdate(bool doForce)
protected async Task ForceUpdate(bool doForce)
{
currRecord = null;
await ReloadData();