diff --git a/src/backend/base/langflow/api/v1/chat.py b/src/backend/base/langflow/api/v1/chat.py index c15c1cb39..a9743aec5 100644 --- a/src/backend/base/langflow/api/v1/chat.py +++ b/src/backend/base/langflow/api/v1/chat.py @@ -329,8 +329,7 @@ async def build_flow( build_task = asyncio.create_task(await asyncio.to_thread(_build_vertex, vertex_id, graph)) try: await build_task - except asyncio.CancelledError as exc: - logger.exception(exc) + except asyncio.CancelledError: build_task.cancel() return diff --git a/src/backend/base/langflow/services/tracing/service.py b/src/backend/base/langflow/services/tracing/service.py index d42621f3e..86def8d00 100644 --- a/src/backend/base/langflow/services/tracing/service.py +++ b/src/backend/base/langflow/services/tracing/service.py @@ -211,7 +211,7 @@ class TracingService(Service): self._end_traces(trace_id, trace_name, e) raise e finally: - asyncio.create_task(asyncio.to_thread(self._end_and_reset, trace_id, trace_name, None)) + asyncio.create_task(await asyncio.to_thread(self._end_and_reset, trace_id, trace_name, None)) async def _end_and_reset(self, trace_id: str, trace_name: str, error: Exception | None = None): self._end_traces(trace_id, trace_name, error)