Weave the shutdown hook into the lifecycle docs

Rolled down from the stack's docs-only tip PR: lifecycle step 5 now
describes shutdown-hook ordering, and the shutdown() hook docs
cross-reference the lifecycle and background-task sections.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012U7coQfVu8nK2R4q2mCULA
This commit is contained in:
Alex Garcia 2026-09-01 17:53:02 -07:00
commit f614a781bb
2 changed files with 2 additions and 2 deletions

View file

@ -1221,7 +1221,7 @@ This hook fires once, when the Datasette application server is shutting down gra
Like ``startup()``, this can be a regular function or it can return an async function to be awaited.
It runs before Datasette cancels any background tasks it is supervising and before it closes its database connections, so you can use it to tell your plugin's own background work to stop gracefully while a database connection is still available to write out any final state:
It runs before Datasette cancels any background tasks it is supervising (see :ref:`datasette_add_background_task`) and before it closes its database connections, so you can use it to tell your plugin's own background work to stop gracefully while a database connection is still available to write out any final state. See :ref:`datasette_lifecycle` for exactly where this fits into the full startup-to-shutdown sequence:
.. code-block:: python