flows: fix planner removing too many stages

This commit is contained in:
Jens Langhammer 2020-09-26 14:58:13 +02:00
parent ae435f423e
commit 64a71a3663
1 changed files with 6 additions and 4 deletions

View File

@ -46,22 +46,24 @@ class FlowPlan:
self.stages.append(stage)
self.markers.append(marker or StageMarker())
def next(self, offset=0) -> Optional[Stage]:
def next(self) -> Optional[Stage]:
"""Return next pending stage from the bottom of the list"""
if not self.has_stages:
return None
stage = self.stages[offset]
marker = self.markers[offset]
stage = self.stages[0]
marker = self.markers[0]
if marker.__class__ is not StageMarker:
LOGGER.debug("f(plan_inst): stage has marker", stage=stage, marker=marker)
marked_stage = marker.process(self, stage)
if not marked_stage:
LOGGER.debug("f(plan_inst): marker returned none, next stage", stage=stage)
self.stages.remove(stage)
self.markers.remove(marker)
if not self.has_stages:
return None
# pylint: disable=not-callable
return self.next(offset + 1)
return self.next()
return marked_stage
def pop(self):