Update gestione coda invio/ricezione messaggi

This commit is contained in:
Samuele Locatelli
2023-05-11 11:55:10 +02:00
parent b4f3891a85
commit 0169d9d8d1
2 changed files with 60 additions and 9 deletions
@@ -275,7 +275,7 @@ namespace WebDoorCreator.Data.Services
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
// per prima cosa controllo se ho GIA' in coda qualcosa come richeiste
// per prima cosa controllo se ho GIA' in coda qualcosa come richieste
long numPending = await NumRequestPending();
// se coda non vuota: cerco la DoorId corrente, se c'è sovrascrivo versione altrimenti
@@ -309,6 +309,7 @@ namespace WebDoorCreator.Data.Services
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"SendCalcReq | DoorId: {DoorId} enqueued in: {ts.TotalMilliseconds} ms");
#if false
// FIXME TODO!!!! levare quando ci sarà il vero sw in esecuzione...
// simulazione ritorno dati...
@@ -328,7 +329,8 @@ namespace WebDoorCreator.Data.Services
await Task.Delay(300);
string retMess = $"{sDoorId}:{sCurrVers}";
// invio il FINTO messaggio di ritorno...
CalcDonePipe.saveAndSendMessage(Constants.LAST_CALC_DONE_KEY, retMess);
CalcDonePipe.saveAndSendMessage(Constants.LAST_CALC_DONE_KEY, retMess);
#endif
return currVers;
}
@@ -399,7 +401,7 @@ namespace WebDoorCreator.Data.Services
}
/// <summary>
/// Invio elenco risultati elaborazioni (modalità boolean di esecuzione corretta)
/// Salvo elenco risultati elaborazioni (modalità boolean di esecuzione corretta)
/// </summary>
/// <param name="calcResults">Risultati elaborazioni in formato CalcResultDTO</param>
/// <returns></returns>
@@ -407,6 +409,27 @@ namespace WebDoorCreator.Data.Services
{
bool answ = true;
await Task.Delay(1);
if (calcResults != null && calcResults.Count > 0)
{
string sDoorId = "";
string sCurrVers = "";
foreach (var calcTask in calcResults)
{
// solo se risultato valido...
if (calcTask.Validated)
{
// salvo in area REDIS
var doorData = calcTask.DoorIdVers.Split(".");
sDoorId = doorData.Length > 0 ? doorData[0] : "";
sCurrVers = doorData.Length > 0 ? doorData[0] : "";
RedisKey currSvgKey = new RedisKey($"{Constants.CALC_REQ_SVG_CACHE}:{sDoorId}:{sCurrVers}");
await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen, DayLongCache);
// invio il FINTO messaggio di ritorno...
string retMess = $"{sDoorId}:{sCurrVers}";
CalcDonePipe.saveAndSendMessage(Constants.LAST_CALC_DONE_KEY, retMess);
}
}
}
return answ;
}
+34 -6
View File
@@ -14,13 +14,13 @@ order:
line:
date: 2023-05-10T00:00:00.0000000Z
piece: DO_1
properties: Oak
properties: Pine
finishing: Varnishing
size:
width: 33.8125
height: 81.25
thickness: 1.75
swing: LH
swing: RH
secure: UP
material: wood
profiles:
@@ -41,10 +41,38 @@ profiles:
machining: ON
overmaterial: 0.1
hardware:
ept:
- template: Generic\StdEPT
ToptoCL: 15
FacetoCL: 0.875
flush_pulls:
- template: Generic\Circle
position: 35
back_set: 5
depth: 1
face: secure
- template: Generic\Circle
position: 35
back_set: 5
depth: 1
face: secure
locks:
- template: Generic\DocMyTest5Bore.nge
position: 45.875
back_set: 2.0
offset_WS: 0.0
side: lock_top
hinges:
- template: Generic Conceiled\StdConHingeDeepR
ToptoCL: 4.875
back_set: 0.125
thickness: 0.25
groove:
- template: Generic\Groove
type: side
width: 0.6
depth: 0.8
offset_WS: 0
side: bottom
---