MCPcopy
hub / github.com/encode/uvicorn / shutdown

Method shutdown

uvicorn/lifespan/on.py:64–76  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

62 self.logger.info("Application startup complete.")
63
64 async def shutdown(self) -> None:
65 if self.error_occurred:
66 return
67 self.logger.info("Waiting for application shutdown.")
68 shutdown_event: LifespanShutdownEvent = {"type": "lifespan.shutdown"}
69 await self.receive_queue.put(shutdown_event)
70 await self.shutdown_event.wait()
71
72 if self.shutdown_failed or (self.error_occurred and self.config.lifespan == "on"):
73 self.logger.error("Application shutdown failed. Exiting.")
74 self.should_exit = True
75 else:
76 self.logger.info("Application shutdown complete.")
77
78 async def main(self) -> None:
79 try:

Callers 1

testFunction · 0.95

Calls

no outgoing calls

Tested by 1

testFunction · 0.76