diff --git a/haystack/core/pipeline/base.py b/haystack/core/pipeline/base.py index be7c0737d0..9a656552dd 100644 --- a/haystack/core/pipeline/base.py +++ b/haystack/core/pipeline/base.py @@ -916,13 +916,12 @@ def _distribute_output( is_greedy = getattr(receiver, "__haystack_is_greedy__", False) if receiver_socket.is_variadic and is_greedy: - # If the receiver is greedy, we can run it right away. + # If the receiver is greedy, we can run it as soon as possible. # First we remove it from the status lists it's in if it's there or we risk running it multiple times. - if pair in to_run: - to_run.remove(pair) if pair in waiting_for_input: waiting_for_input.remove(pair) - to_run.append(pair) + if pair not in to_run: + to_run.append(pair) if pair not in waiting_for_input and pair not in to_run: # Queue up the Component that received this input to run, only if it's not already waiting