Ok salvataggio SVG su redis

This commit is contained in:
Samuele Locatelli
2023-04-19 13:31:31 +02:00
parent 3f0c0e2b93
commit 7995436689
3 changed files with 17 additions and 11 deletions
+1
View File
@@ -23,6 +23,7 @@ namespace WebDoorCreator.Core
public static readonly string CALC_REQ_PROC = $"{BASE_HASH}:CalcRequests:Processing";
public static readonly string CALC_REQ_DONE = $"{BASE_HASH}:CalcRequests:Completed";
public static readonly string CALC_REQ_DDF_CACHE = $"{BASE_HASH}:CalcRequests:CacheDDF";
public static readonly string CALC_REQ_SVG_CACHE = $"{BASE_HASH}:CalcRequests:CacheSVG";
// REDIS Channels messaggi x QueueMan (verso UI/srv)
public static readonly string CALC_REQ_QUEUE = $"CalcRequest";
@@ -101,11 +101,8 @@ namespace WebDoorCreator.Data.Services
// salvo nell'archivio REDIS delle porte il DDF corrente (key=doorId.versNumb), potrebbe
// venire buono anche x eventuale UNDO...
RedisKey currKey = new RedisKey($"{Constants.CALC_REQ_DDF_CACHE}:{sDoorId}:{sCurrVers}");
string rawData = JsonConvert.SerializeObject(FullDDF, JSSettings);
await redisDb.StringSetAsync(currKey, FullDDF, DayLongCache);
//await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
RedisKey currDdfKey = new RedisKey($"{Constants.CALC_REQ_DDF_CACHE}:{sDoorId}:{sCurrVers}");
await redisDb.StringSetAsync(currDdfKey, FullDDF, DayLongCache);
// invio sul canale dei messaggi il numero di items in coda attuali x chiedere esecuzione...
numPending = await NumRequestPending();
@@ -117,19 +114,27 @@ namespace WebDoorCreator.Data.Services
Log.Debug($"SendCalcReq | DoorId: {DoorId} enqueued in: {ts.TotalMilliseconds} ms");
// FIXME TODO!!!! levare quando ci sarà il vero sw in esecuzione...
// simulazione ritorno dati...
await Task.Delay(200);
// invio il FINTO messaggio di ritorno...
string retMess = "";
string fileName = Path.Combine("temp", $"Logo{idxSim:00}.svg");
if (File.Exists(fileName))
{
retMess = File.ReadAllText(fileName);
// update indici
idxSim++;
idxSim = idxSim % 4;
// leggo file
string svgCont = File.ReadAllText(fileName);
// salvo in area REDIS
RedisKey currSvgKey = new RedisKey($"{Constants.CALC_REQ_SVG_CACHE}:{sDoorId}:{sCurrVers}");
await redisDb.StringSetAsync(currSvgKey, svgCont, DayLongCache);
}
// simulo attesa segnalazione messaggio porta calcolata
await Task.Delay(300);
string retMess = $"{sDoorId}:{sCurrVers}";
// invio il FINTO messaggio di ritorno...
CalcDonePipe.saveAndSendMessage(Constants.LAST_CALC_DONE_KEY, retMess);
return currVers;
+1 -1
View File
@@ -3,7 +3,7 @@
#Door1
code: 0015943
date: 2023-04-19T13:16:56.3256631+02:00
date: 2023-04-19T13:29:39.4079805+02:00
material: wood
measures: millimiters
order: