Skip to content

Commit

Permalink
dependencygraph: simplify container start logic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
petderek committed Feb 22, 2019
1 parent fa040f4 commit 89bb2e8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions agent/engine/dependencygraph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 89bb2e8

Please sign in to comment.