diff --git a/docs/usage/applications.rst b/docs/usage/applications.rst index 3bd7aeec21..5e33cc9528 100644 --- a/docs/usage/applications.rst +++ b/docs/usage/applications.rst @@ -36,8 +36,8 @@ order, once the ASGI server (uvicorn, hypercorn, etc.) emits the respective even .. mermaid:: flowchart LR - Startup[ASGI-Event: lifespan.startup] --> before_startup --> on_startup --> after_startup - Shutdown[ASGI-Event: lifespan.shutdown] --> before_shutdown --> on_shutdown --> after_shutdown + Startup[ASGI-Event: lifespan.startup] --> on_startup + Shutdown[ASGI-Event: lifespan.shutdown] --> on_shutdown A classic use case for this is database connectivity. Often, we want to establish a database connection on application startup, and then close it gracefully upon shutdown. diff --git a/litestar/app.py b/litestar/app.py index 622fae784e..e50e808fa7 100644 --- a/litestar/app.py +++ b/litestar/app.py @@ -528,9 +528,8 @@ async def lifespan(self) -> AsyncGenerator[None, None]: It will be entered when the ``lifespan`` message has been received from the server, and exit after the ``asgi.shutdown`` message. During this period, it is - responsible for calling the ``before_startup``, ``after_startup``, - `on_startup``, ``before_shutdown``, ``on_shutdown`` and ``after_shutdown`` - hooks, as well as custom lifespan managers. + responsible for calling the ``on_startup``, ``on_shutdown`` hooks, as well as + custom lifespan managers. """ async with AsyncExitStack() as exit_stack: for hook in self.on_shutdown[::-1]: