Skip to content

Commit

Permalink
fix(docs): remove stale hooks #2375 (#2377)
Browse files Browse the repository at this point in the history
* fix(docs): remove stale hooks #2375

* fix(docs): update old doc string
  • Loading branch information
JacobCoffee committed Sep 28, 2023
1 parent ab84566 commit 062092b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/usage/applications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions litestar/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 062092b

Please sign in to comment.