From de596ae073fd467b2a48915c5adf6f1331b78919 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 5 Jul 2024 10:30:54 -0300 Subject: [PATCH] fix(ordering): correctly remove vertex from list of runnable vertices (#2554) --- src/backend/base/langflow/api/v1/chat.py | 7 ------- .../base/langflow/graph/graph/runnable_vertices_manager.py | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/backend/base/langflow/api/v1/chat.py b/src/backend/base/langflow/api/v1/chat.py index ecd85748ed9d..716afca724a5 100644 --- a/src/backend/base/langflow/api/v1/chat.py +++ b/src/backend/base/langflow/api/v1/chat.py @@ -105,13 +105,6 @@ async def retrieve_vertices_order( first_layer = graph.sort_vertices() else: first_layer = graph.sort_vertices() - # When we send vertices to the frontend - # we need to remove them from the predecessors - # so they are not considered for building again - # which duplicates the results - for vertex_id in first_layer: - graph.remove_from_predecessors(vertex_id) - graph.remove_vertex_from_runnables(vertex_id) # Now vertices is a list of lists # We need to get the id of each vertex diff --git a/src/backend/base/langflow/graph/graph/runnable_vertices_manager.py b/src/backend/base/langflow/graph/graph/runnable_vertices_manager.py index 46d59066ea3f..95805ced05e1 100644 --- a/src/backend/base/langflow/graph/graph/runnable_vertices_manager.py +++ b/src/backend/base/langflow/graph/graph/runnable_vertices_manager.py @@ -107,7 +107,7 @@ async def get_next_runnable_vertices( """ async with lock: - self.remove_from_predecessors(vertex.id) + self.remove_vertex_from_runnables(vertex.id) direct_successors_ready = [ v for v in vertex.successors_ids if self.is_vertex_runnable(v, graph.inactivated_vertices) ]