diff --git a/WebDoorCreator.API/Controllers/QueueController.cs b/WebDoorCreator.API/Controllers/QueueController.cs
index da489a7..9498d25 100644
--- a/WebDoorCreator.API/Controllers/QueueController.cs
+++ b/WebDoorCreator.API/Controllers/QueueController.cs
@@ -37,6 +37,9 @@ namespace WebDoorCreator.API.Controllers
var actProc = await QDataServ.NumRequestProcessing();
answ.Add("processing", actProc);
+ var actErr = await QDataServ.NumRequestErrors();
+ answ.Add("errors", actErr);
+
var actDone = await QDataServ.NumRequestDone();
answ.Add("done", actDone);
return answ;
@@ -88,6 +91,9 @@ namespace WebDoorCreator.API.Controllers
var actProc = await QDataServ.RequestProcessing();
answ.Add("processing", actProc);
+ var actErr = await QDataServ.RequestErr();
+ answ.Add("errors", actErr);
+
var actDone = await QDataServ.RequestDone();
answ.Add("done", actDone);
return answ;
diff --git a/WebDoorCreator.Data/Services/QueueDataService.cs b/WebDoorCreator.Data/Services/QueueDataService.cs
index 93cc9c8..17a6c05 100644
--- a/WebDoorCreator.Data/Services/QueueDataService.cs
+++ b/WebDoorCreator.Data/Services/QueueDataService.cs
@@ -102,6 +102,25 @@ namespace WebDoorCreator.Data.Services
return numReq;
}
+ ///
+ /// Get # of calculation request with errors
+ ///
+ public async Task NumRequestErrors()
+ {
+ long numReq = 0;
+ string source = "REDIS";
+ Dictionary dictResult = new Dictionary();
+ // cerco da cache
+ RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS);
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ numReq = await redisDb.HashLengthAsync(currKey);
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Debug($"NumRequestErrors | {source} in: {ts.TotalMilliseconds} ms");
+ return numReq;
+ }
+
///
/// Get # of calculation request pending
///
@@ -207,6 +226,35 @@ namespace WebDoorCreator.Data.Services
long numReq = await RedHashUpsert(currKey, doorId, vers);
return numReq;
}
+
+ ///
+ /// Get Queue request with errors
+ ///
+ /// Dictionary of DoorId, saveVersNumb
+ public async Task> RequestErr()
+ {
+ string source = "REDIS";
+ long numReq = 0;
+ Dictionary dictResult = new Dictionary();
+ // cerco da cache
+ RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS);
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ numReq = redisDb.HashLength(currKey);
+ if (numReq > 0)
+ {
+ var rawData = await redisDb.HashGetAllAsync(currKey);
+ foreach (var item in rawData)
+ {
+ dictResult.Add($"{item.Name}", $"{item.Value}");
+ }
+ }
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Debug($"RequestErr | {source} in: {ts.TotalMilliseconds} ms");
+ return dictResult;
+ }
+
///
/// Rimuove hash record errori
///
@@ -348,6 +396,15 @@ namespace WebDoorCreator.Data.Services
await RequestProcessingRemove(item.Name!);
fatto = true;
}
+ // cerco le richieste con errori
+ currKey = new RedisKey(Constants.CALC_REQ_ERRS);
+ rawData = await redisDb.HashGetAllAsync(currKey);
+ foreach (var item in rawData)
+ {
+ await RequestPendingUpsert(item.Name!, item.Value!);
+ await RequestErrRemove(item.Name!);
+ fatto = true;
+ }
// cerco le richieste processed
currKey = new RedisKey(Constants.CALC_REQ_DONE);
rawData = await redisDb.HashGetAllAsync(currKey);