[BugFix] make sure socket close (#15875)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong 2025-04-02 04:10:24 +08:00 committed by GitHub
parent 7acd539cd7
commit 93491aefc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1098,9 +1098,10 @@ async def run_server(args, **uvicorn_kwargs) -> None:
)
# NB: Await server shutdown only after the backend context is exited
await shutdown_task
sock.close()
try:
await shutdown_task
finally:
sock.close()
if __name__ == "__main__":