refactor: remove completed request from dictionary

This commit is contained in:
Andrew Welker
2022-09-01 11:57:40 -06:00
parent d7cccc0709
commit 358f44cfe5

View File

@@ -70,12 +70,19 @@ namespace PepperDash.Essentials.Core
//New Request
if (coolingDevice != null && coolingDevice.IsCoolingDownFeedback.BoolValue == true)
{
coolingDevice.IsCoolingDownFeedback.OutputChange -= routeRequest.HandleCooldown;
coolingDevice.IsCoolingDownFeedback.OutputChange += routeRequest.HandleCooldown;
RouteRequests.Add(destination.Key, routeRequest);
return;
}
if (RouteRequests.ContainsKey(destination.Key) && coolingDevice != null && coolingDevice.IsCoolingDownFeedback.BoolValue == false)
{
RouteRequests.Remove(destination.Key);
}
destination.ReleaseRoute();
RunRouteRequest(routeRequest);