-
-
Notifications
You must be signed in to change notification settings - Fork 25
Uvicorn Shutdown
Aber edited this page Jun 18, 2021
·
3 revisions
origin_shutdown = uvicorn.Server.shutdown
class Server(uvicorn.Server):
async def shutdown(self, sockets=None):
# Uvicorn 会先等待 Connections 完成,但对于长连接来说永远不会完成
for connection in self.server_state.connections:
connection.transport.abort()
return await origin_shutdown(self, sockets=sockets)
uvicorn.Server.shutdown = Server.shutdown