Issue - We are seeing that the ConsumeQueue returns SUCCESS when it should return failure
Description - In case the ConsumeQueue decorator node is part of a tree that has Async action node the events where SUCCESS instead of FAILURE is returned can look like this -
- Inside
while(!items.empty()) last item is popped
- child_node_ is ticked
- child_state is RUNNING hence RUNNING is returned from ConsumeQueue::tick()
- On next tick ConsumeQueue::tick() is called
- running_child_ was true from the previous tick
- State of child_node_ is checked and let's say it returns FAILURE
- haltChild() gets called and the logic continues on <---- THIS IS WHERE THE ISSUE IS
while(!items.empty()) is not entered since queue is empty
- SUCCESS is returned at the bottom
A potential solution is to move reading the InputPort queue at the top. In case running_child_ is true followed by child_state_ is not RUNNING and queue->items.empty() is true, child_state_ should be returned after calling haltChild()