_shutdown() — fastapi Function Reference
Architecture documentation for the _shutdown() function in routing.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 9832243d_074a_bd6d_dffb_f7cbb65baa7d["_shutdown()"] ecadd3bc_0c58_b4e5_06d8_57da79199adc["APIRouter"] 9832243d_074a_bd6d_dffb_f7cbb65baa7d -->|defined in| ecadd3bc_0c58_b4e5_06d8_57da79199adc 0bcce1e6_c4c6_e1ff_31ae_19d689ccec1d["__aexit__()"] 0bcce1e6_c4c6_e1ff_31ae_19d689ccec1d -->|calls| 9832243d_074a_bd6d_dffb_f7cbb65baa7d style 9832243d_074a_bd6d_dffb_f7cbb65baa7d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
fastapi/routing.py lines 4567–4580
async def _shutdown(self) -> None:
"""
Run any `.on_shutdown` event handlers.
This method is kept for backward compatibility after Starlette removed
support for on_startup/on_shutdown handlers.
Ref: https://github.com/Kludex/starlette/pull/3117
"""
for handler in self.on_shutdown:
if is_async_callable(handler):
await handler()
else:
handler()
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _shutdown() do?
_shutdown() is a function in the fastapi codebase, defined in fastapi/routing.py.
Where is _shutdown() defined?
_shutdown() is defined in fastapi/routing.py at line 4567.
What calls _shutdown()?
_shutdown() is called by 1 function(s): __aexit__.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free