Completo fix x reload e calcolo corretto DDF in caso di sovrapposizione richieste

This commit is contained in:
Samuele Locatelli
2024-03-11 12:51:04 +01:00
parent 2fa5a0df16
commit ab5757d0bd
10 changed files with 109 additions and 75 deletions
@@ -15,16 +15,18 @@ namespace WebDoorCreator.UI.Controllers
public DoorImageController(IConfiguration configuration, QueueDataService cQDService, WebDoorCreatorService cWDCService)
{
Log.Info("Starting DoorImageController");
Log.Trace("Starting DoorImageController");
_configuration = configuration;
WaitReloadSvg = _configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg");
QDService = cQDService;
WDService = cWDCService;
Log.Info("Avviato DoorImageController");
Log.Trace("Avviato DoorImageController");
}
#endregion Public Constructors
private Random rnd = new Random();
#region Public Methods
// GET: api/DoorImage
@@ -44,7 +46,7 @@ namespace WebDoorCreator.UI.Controllers
string vetoReq = await QDService.DoorProcVetoGetAsync(DoorId);
if (string.IsNullOrEmpty(vetoReq))
{
await QDService.DoorProcVetoSetAsync(DoorId, 2000);
await QDService.DoorProcVetoSetAsync(DoorId, WaitReloadSvg * 20);
// richiede ricalcolo img
await SendRecalcReq(DoorId);
@@ -53,6 +55,13 @@ namespace WebDoorCreator.UI.Controllers
// riprova lettura
svgContent = await QDService.DoorGetLastSvg(DoorId);
}
else
{
// attesa causale per vedere SE riesce a leggere ugualmente...faccio rand (4..10)*wait reload...
await Task.Delay(WaitReloadSvg * rnd.Next(4, 10));
// riprovo lettura
svgContent = await QDService.DoorGetLastSvg(DoorId);
}
}
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))