From 89bb2e8578421bde44429611238ad6bcf30c0a9d Mon Sep 17 00:00:00 2001 From: Derek Petersen Date: Thu, 21 Feb 2019 13:12:50 -0800 Subject: [PATCH] dependencygraph: simplify container start logic Instead of explicitly checking against many conditions, we now validate that the expected condition has progressed beyond started This mirrors prior behavior in the codebase, and reduces cyclo complexity. --- agent/engine/dependencygraph/graph.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/agent/engine/dependencygraph/graph.go b/agent/engine/dependencygraph/graph.go index 2c7b6b0d767..d92436bac4b 100644 --- a/agent/engine/dependencygraph/graph.go +++ b/agent/engine/dependencygraph/graph.go @@ -328,9 +328,7 @@ func containerOrderingDependenciesIsResolved(target *apicontainer.Container, // The 'target' container desires to be moved to 'Created' or the 'steady' state. // Allow this only if the known status of the dependency container state is already started // i.e it's state is any of 'Created', 'steady state' or 'Stopped' - return dependsOnContainerKnownStatus == apicontainerstatus.ContainerCreated || - dependsOnContainerKnownStatus == apicontainerstatus.ContainerStopped || - dependsOnContainerKnownStatus == dependsOnContainer.GetSteadyStateStatus() + return dependsOnContainerKnownStatus >= apicontainerstatus.ContainerCreated case runningCondition: if targetDesiredStatus == apicontainerstatus.ContainerCreated {