diff --git a/WebDoorCreator.API/Controllers/QueueController.cs b/WebDoorCreator.API/Controllers/QueueController.cs index fd15fd8..7417931 100644 --- a/WebDoorCreator.API/Controllers/QueueController.cs +++ b/WebDoorCreator.API/Controllers/QueueController.cs @@ -113,16 +113,8 @@ namespace WebDoorCreator.API.Controllers { foreach (var item in doors2Del) { - //RedisValue pattern = new RedisValue($"{Core.Constants.}"); - await WDService.FlushCustomPattern($"Cache:Door:{item.DoorId}"); - await WDService.FlushCustomPattern($"CalcRequests:CacheDDF:{item.DoorId}"); - await WDService.FlushCustomPattern($"CalcRequests:CacheSVG:{item.DoorId}"); - await WDService.FlushCustomPattern($"CalcRequests:Errors:{item.DoorId}"); - await QDataServ.DoorRefreshRemove($"{item.DoorId}"); - await QDataServ.RequestDoneRemove($"{item.DoorId}"); - await QDataServ.RequestErrRemove($"{item.DoorId}"); - await QDataServ.RequestPendingRemove($"{item.DoorId}"); - await QDataServ.RequestProcessingRemove($"{item.DoorId}"); + await WDService.RedisBulkDelByDoorId(item.DoorId); + await QDataServ.RedisBulkDelHashByKey(item.DoorId); await WDService.DoorDelete(item); } } diff --git a/WebDoorCreator.Data/Services/QueueDataService.cs b/WebDoorCreator.Data/Services/QueueDataService.cs index a0754d3..6075f89 100644 --- a/WebDoorCreator.Data/Services/QueueDataService.cs +++ b/WebDoorCreator.Data/Services/QueueDataService.cs @@ -140,6 +140,21 @@ namespace WebDoorCreator.Data.Services } return hasErr; } + /// + /// Restitusice gli errori della porta in oggetto + /// + /// formato DoorId:Versione + /// + public async Task RedisBulkDelHashByKey(int doorId) + { + await DoorRefreshRemove($"{doorId}"); + await RequestDoneRemove($"{doorId}"); + await RequestErrRemove($"{doorId}"); + await RequestPendingRemove($"{doorId}"); + await RequestProcessingRemove($"{doorId}"); + + return true; + } /// /// Restitusice gli errori della porta in oggetto diff --git a/WebDoorCreator.Data/Services/WebDoorCreatorService.cs b/WebDoorCreator.Data/Services/WebDoorCreatorService.cs index 7b9ca6a..1fcd47c 100644 --- a/WebDoorCreator.Data/Services/WebDoorCreatorService.cs +++ b/WebDoorCreator.Data/Services/WebDoorCreatorService.cs @@ -161,6 +161,21 @@ namespace WebDoorCreator.Data.Services return listActiveCompo; } + /// + /// + /// Bulk delete chiavi su redis + /// + /// + /// + public async Task RedisBulkDelByDoorId(int doorId) + { + await FlushCustomPattern($"Cache:Door:{doorId}"); + await FlushCustomPattern($"CalcRequests:CacheDDF:{doorId}"); + await FlushCustomPattern($"CalcRequests:CacheSVG:{doorId}"); + await FlushCustomPattern($"CalcRequests:Errors:{doorId}"); + + return true; + } /// /// Setting all the component list