fix: handle coroutine check for on_disconnect callback in chat API (#3930)
Handle coroutine check for on_disconnect callback in chat API
This commit is contained in:
parent
31db1267b4
commit
56d8b0fa49
1 changed files with 3 additions and 1 deletions
|
|
@ -448,7 +448,9 @@ class DisconnectHandlerStreamingResponse(StreamingResponse):
|
|||
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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue