fix: add correct id to vertices_being_run and change condition to end traces (#2872)

* fix: add correct vertex id to vertices_being_run

* fix: update condition for ending all traces in build_vertex function
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-07-22 14:23:29 -03:00 committed by GitHub
commit 912683009f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -258,7 +258,7 @@ async def build_vertex(
if graph.stop_vertex and graph.stop_vertex in next_runnable_vertices:
next_runnable_vertices = [graph.stop_vertex]
if not graph.run_manager.vertices_to_run and not next_runnable_vertices:
if not graph.run_manager.vertices_being_run and not next_runnable_vertices:
background_tasks.add_task(graph.end_all_traces)
build_response = VertexBuildResponse(

View file

@ -998,11 +998,11 @@ class Graph:
self.run_manager.remove_vertex_from_runnables(v_id)
next_runnable_vertices = self.find_next_runnable_vertices(v_id, v_successors_ids)
for i in set(next_runnable_vertices): # Use set to avoid duplicates
if i == v_id:
for next_v_id in set(next_runnable_vertices): # Use set to avoid duplicates
if next_v_id == v_id:
next_runnable_vertices.remove(v_id)
else:
self.run_manager.add_to_vertices_being_run(v_id)
self.run_manager.add_to_vertices_being_run(next_v_id)
if cache:
set_cache_coro = partial(get_chat_service().set_cache, key=self.flow_id)
await set_cache_coro(self, lock)