mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
fix: add removal of RouteRequest when calling ReleaseRoute
This commit is contained in:
@@ -105,6 +105,17 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <param name="destination"></param>
|
/// <param name="destination"></param>
|
||||||
public static void ReleaseRoute(this IRoutingSink destination)
|
public static void ReleaseRoute(this IRoutingSink destination)
|
||||||
{
|
{
|
||||||
|
RouteRequest existingRequest;
|
||||||
|
|
||||||
|
if (RouteRequests.TryGetValue(destination.Key, out existingRequest) && destination is IWarmingCooling)
|
||||||
|
{
|
||||||
|
var coolingDevice = destination as IWarmingCooling;
|
||||||
|
|
||||||
|
coolingDevice.IsCoolingDownFeedback.OutputChange -= existingRequest.HandleCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
RouteRequests.Remove(destination.Key);
|
||||||
|
|
||||||
var current = RouteDescriptorCollection.DefaultCollection.RemoveRouteDescriptor(destination);
|
var current = RouteDescriptorCollection.DefaultCollection.RemoveRouteDescriptor(destination);
|
||||||
if (current != null)
|
if (current != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user