Merge branch 'release/FixRecalcOnMissing02'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>WebDoorCreator - Egalware</i>
|
||||
<h4>Version: 0.9.2403.0819</h4>
|
||||
<h4>Version: 0.9.2403.0911</h4>
|
||||
<br /> Release note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2403.0819
|
||||
0.9.2403.0911
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2403.0819</version>
|
||||
<version>0.9.2403.0911</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace WebDoorCreator.Core
|
||||
public static readonly string CALC_REQ_PROC = $"{BASE_HASH}:CalcRequests:Processing";
|
||||
public static readonly string CALC_REQ_DDF_CACHE = $"{BASE_HASH}:CalcRequests:CacheDDF";
|
||||
public static readonly string CALC_REQ_SVG_CACHE = $"{BASE_HASH}:CalcRequests:CacheSVG";
|
||||
public static readonly string CALC_REQ_VETO_REC = $"{BASE_HASH}:CalcRequests:VetoRecalc";
|
||||
public static readonly string DOOR_TPL_LIST = $"{BASE_HASH}:Template:DoorList";
|
||||
|
||||
// REDIS KEY dati x registrazione statistiche esecuzione
|
||||
|
||||
@@ -188,21 +188,6 @@ namespace WebDoorCreator.Data.Services
|
||||
answ = $"{rawData}";
|
||||
}
|
||||
}
|
||||
#if false
|
||||
// se non trovata --> missing!
|
||||
if (string.IsNullOrEmpty(answ))
|
||||
{
|
||||
// 2024.02.15: se mancasse, provo a richiedere ricalcolo porta... se poi arriva, la
|
||||
// pagina in ascolto l'avrà aggiornata
|
||||
|
||||
// leggo missing standard...
|
||||
string missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
|
||||
if (File.Exists(missingFilePath))
|
||||
{
|
||||
answ = File.ReadAllText(missingFilePath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -214,7 +199,7 @@ namespace WebDoorCreator.Data.Services
|
||||
public string DoorGetMissingSvg()
|
||||
{
|
||||
string answ = missingSvgContent;
|
||||
if(string.IsNullOrEmpty(answ))
|
||||
if (string.IsNullOrEmpty(answ))
|
||||
{
|
||||
// fix dati img missing...
|
||||
missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
|
||||
@@ -223,10 +208,41 @@ namespace WebDoorCreator.Data.Services
|
||||
missingSvgContent = File.ReadAllText(missingFilePath);
|
||||
answ = missingSvgContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca nei VetoProc se ci sia x porta corrente
|
||||
/// </summary>
|
||||
/// <param name="DoorId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> DoorProcVetoGetAsync(int DoorId)
|
||||
{
|
||||
string answ = "";
|
||||
// recupero da REDIS
|
||||
var currVetoKey = new RedisKey($"{Constants.CALC_REQ_VETO_REC}:{DoorId}");
|
||||
var rawData = await redisDb.StringGetAsync(currVetoKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
answ = $"{rawData}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// imposta un VetoProc x porta corrente x 1 sec
|
||||
/// </summary>
|
||||
/// <param name="DoorId">ID porta da vietare x ricalcolo</param>
|
||||
/// <param name="msVeto">Durata veto in ms</param>
|
||||
/// <returns></returns>
|
||||
public async Task DoorProcVetoSetAsync(int DoorId, int msVeto)
|
||||
{
|
||||
// recupero da REDIS
|
||||
var currVetoKey = new RedisKey($"{Constants.CALC_REQ_VETO_REC}:{DoorId}");
|
||||
var rawData = await redisDb.StringSetAsync(currVetoKey, $"{DoorId}", TimeSpan.FromMilliseconds(msVeto));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove for single hash record
|
||||
/// </summary>
|
||||
@@ -1256,10 +1272,10 @@ namespace WebDoorCreator.Data.Services
|
||||
* se non trova riparte da 1
|
||||
*
|
||||
----------------------------------*/
|
||||
int currVers = 1;
|
||||
int currVers = 0;
|
||||
string sCurrVers = "";
|
||||
// per prima cosa controllo se ho GIA' in coda qualcosa come richieste
|
||||
if (await NumRequestPending() > 0)
|
||||
if (string.IsNullOrEmpty(sCurrVers) && await NumRequestPending() > 0)
|
||||
{
|
||||
var currPending = await RequestPending();
|
||||
if (currPending != null)
|
||||
@@ -1267,13 +1283,11 @@ namespace WebDoorCreator.Data.Services
|
||||
if (currPending.ContainsKey(sDoorId))
|
||||
{
|
||||
sCurrVers = currPending[sDoorId];
|
||||
int.TryParse(sCurrVers, out currVers);
|
||||
currVers++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// cerco coda errori
|
||||
if (await NumRequestErrors() > 0)
|
||||
if (string.IsNullOrEmpty(sCurrVers) && await NumRequestErrors() > 0)
|
||||
{
|
||||
var currErrors = await RequestErr();
|
||||
if (currErrors != null)
|
||||
@@ -1281,13 +1295,11 @@ namespace WebDoorCreator.Data.Services
|
||||
if (currErrors.ContainsKey(sDoorId))
|
||||
{
|
||||
sCurrVers = currErrors[sDoorId];
|
||||
int.TryParse(sCurrVers, out currVers);
|
||||
currVers++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// cerco coda task completati
|
||||
if (await NumRequestDone() > 0)
|
||||
if (string.IsNullOrEmpty(sCurrVers) && await NumRequestDone() > 0)
|
||||
{
|
||||
var currDone = await RequestDone();
|
||||
if (currDone != null)
|
||||
@@ -1295,11 +1307,12 @@ namespace WebDoorCreator.Data.Services
|
||||
if (currDone.ContainsKey(sDoorId))
|
||||
{
|
||||
sCurrVers = currDone[sDoorId];
|
||||
int.TryParse(sCurrVers, out currVers);
|
||||
currVers++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// calcolo ed incremento
|
||||
int.TryParse(sCurrVers, out currVers);
|
||||
currVers++;
|
||||
// inserisco in coda x calcoli
|
||||
await RequestPendingUpsert(sDoorId, $"{currVers}");
|
||||
// metto in coda "last calc" la porta corrente x pulizia successiva
|
||||
@@ -1404,6 +1417,7 @@ namespace WebDoorCreator.Data.Services
|
||||
/// Path dell'immagine "missing"
|
||||
/// </summary>
|
||||
private string missingFilePath = "";
|
||||
|
||||
/// <summary>
|
||||
/// Contenuto SVG dell'immagine missing
|
||||
/// </summary>
|
||||
|
||||
@@ -259,10 +259,17 @@ namespace WebDoorCreator.UI.Components.DoorMan
|
||||
isTpl = isClose;
|
||||
await ReloadData();
|
||||
}
|
||||
private int lastOrderId = -1;
|
||||
private DoorsSelectFilter lastFilt = new DoorsSelectFilter() { CurrPage = -1 };
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
if (currOrderId != lastOrderId || !actFilter.Equals(lastFilt))
|
||||
{
|
||||
lastOrderId = currOrderId;
|
||||
lastFilt = actFilter.clone();
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -287,7 +294,7 @@ namespace WebDoorCreator.UI.Components.DoorMan
|
||||
|
||||
// chiamo reset richieste
|
||||
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
|
||||
|
||||
|
||||
// se ho porte da processare --> chiamo save...
|
||||
string currDDF = "";
|
||||
int currDoorId = 0;
|
||||
@@ -373,17 +380,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
if (DoorsList != null)
|
||||
{
|
||||
var currDoor = DoorsList.FirstOrDefault();
|
||||
if (currDoor?.OrderNav != null)
|
||||
{
|
||||
//orderStatus = currDoor.OrderNav.Status;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace WebDoorCreator.UI.Controllers
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
private static List<int> DoorIdProc = new List<int>();
|
||||
|
||||
public DoorImageController(IConfiguration configuration, QueueDataService cQDService, WebDoorCreatorService cWDCService)
|
||||
{
|
||||
Log.Info("Starting DoorImageController");
|
||||
@@ -43,15 +41,17 @@ namespace WebDoorCreator.UI.Controllers
|
||||
// se fosse vuoto...
|
||||
if (string.IsNullOrEmpty(svgContent))
|
||||
{
|
||||
if (DoorIdProc.Contains(DoorId))
|
||||
string vetoReq = await QDService.DoorProcVetoGetAsync(DoorId);
|
||||
if (string.IsNullOrEmpty(vetoReq))
|
||||
{
|
||||
DoorIdProc.Remove(DoorId);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoorIdProc.Add(DoorId);
|
||||
await QDService.DoorProcVetoSetAsync(DoorId, 2000);
|
||||
// richiede ricalcolo img
|
||||
svgContent = await SendRecalcReq(DoorId);
|
||||
await SendRecalcReq(DoorId);
|
||||
|
||||
// attende ...
|
||||
await Task.Delay(WaitReloadSvg);
|
||||
// riprova lettura
|
||||
svgContent = await QDService.DoorGetLastSvg(DoorId);
|
||||
}
|
||||
}
|
||||
// se fosse vuoto...
|
||||
@@ -60,10 +60,6 @@ namespace WebDoorCreator.UI.Controllers
|
||||
// legge img vuota
|
||||
svgContent = QDService.DoorGetMissingSvg();
|
||||
}
|
||||
else
|
||||
{
|
||||
DoorIdProc.Remove(DoorId);
|
||||
}
|
||||
var result = System.Text.Encoding.UTF8.GetBytes(svgContent);
|
||||
return File(result, "image/svg+xml");
|
||||
}
|
||||
@@ -93,29 +89,22 @@ namespace WebDoorCreator.UI.Controllers
|
||||
/// </summary>
|
||||
/// <param name="DoorId"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<string> SendRecalcReq(int DoorId)
|
||||
private async Task SendRecalcReq(int DoorId)
|
||||
{
|
||||
string answ = "";
|
||||
// richiede ricalcolo img
|
||||
List<string> doorIdList = new List<string>() { $"{DoorId}" };
|
||||
// chiamo reset richieste
|
||||
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
|
||||
await Task.Delay(WaitReloadSvg);
|
||||
|
||||
// recupero DDF ed invio x processing
|
||||
if (DoorId > 0)
|
||||
{
|
||||
// richiede ricalcolo img
|
||||
List<string> doorIdList = new List<string>() { $"{DoorId}" };
|
||||
// chiamo reset richieste
|
||||
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
|
||||
await Task.Delay(WaitReloadSvg);
|
||||
|
||||
// recupero DDF ed invio x processing
|
||||
string currDDF = await WDService.DoorOpGetDDF(DoorId);
|
||||
// versione corrente del DDF generato
|
||||
int currVers = await QDService.SendCalcReq(DoorId, currDDF);
|
||||
await Task.Delay(WaitReloadSvg);
|
||||
}
|
||||
|
||||
// attende ...
|
||||
await Task.Delay(WaitReloadSvg);
|
||||
// riprova lettura
|
||||
answ = await QDService.DoorGetLastSvg(DoorId);
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.9.2403.0819</Version>
|
||||
<Version>0.9.2403.0911</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user