Skip to content

Commit a285f56

Browse files
committed
Apply reviewer comments
1 parent 866d9ae commit a285f56

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

py_trees/composites.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,10 @@ def tick(self) -> typing.Iterator[behaviour.Behaviour]:
874874
yield node
875875
if node is self.main:
876876
if node.status in (common.Status.SUCCESS, common.Status.RUNNING):
877-
self.status = node.status
877+
if node.status == common.Status.SUCCESS:
878+
self.stop(node.status)
879+
else:
880+
self.status = node.status
878881
yield self
879882
return
880883
elif node.status == common.Status.FAILURE:
@@ -907,7 +910,7 @@ def tick(self) -> typing.Iterator[behaviour.Behaviour]:
907910
yield self
908911

909912
# No recoveries left → fail
910-
self.status = common.Status.FAILURE
913+
self.stop(common.Status.FAILURE)
911914
yield self
912915

913916
def stop(self, new_status: common.Status = common.Status.INVALID) -> None:
@@ -917,8 +920,11 @@ def stop(self, new_status: common.Status = common.Status.INVALID) -> None:
917920
Args:
918921
new_status : the composite is transitioning to this new status
919922
"""
920-
for child in self.children:
923+
self.logger.debug(
924+
f"{self.__class__.__name__}.stop()[{self.status}->{new_status}]"
925+
)
926+
for child in self.children[1:]:
921927
if child.status != common.Status.INVALID:
922928
child.stop(common.Status.INVALID)
923929
self.current_recovery_index = 0
924-
super().stop(new_status)
930+
Composite.stop(self, new_status)

0 commit comments

Comments
 (0)