Skip to content

Commit

Permalink
fix: handle coroutine check for on_disconnect callback in chat API (#…
Browse files Browse the repository at this point in the history
…3930)

Handle coroutine check for on_disconnect callback in chat API
  • Loading branch information
ogabrielluiz authored Sep 26, 2024
1 parent 31db126 commit 56d8b0f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/backend/base/langflow/api/v1/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ async def listen_for_disconnect(self, receive: Receive) -> None:
message = await receive()
if message["type"] == "http.disconnect":
if self.on_disconnect:
await self.on_disconnect()
coro = self.on_disconnect()
if asyncio.iscoroutine(coro):
await coro
break


Expand Down

0 comments on commit 56d8b0f

Please sign in to comment.