diff --git a/datasette/app.py b/datasette/app.py index 5df0c1e8..9f6c81d3 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -2910,10 +2910,9 @@ class Datasette: plugin's cleanup, or skip task cancellation / ``close()`` altogether. - Order matters (decision #6, ``plans/first-request/04-core-plan.md``): - hooks run first, while background tasks are still alive, so a - plugin can coordinate with its own task (e.g. tell a queue - consumer to stop pulling new work) before that task gets + Order matters: hooks run first, while background tasks are still + alive, so a plugin can coordinate with its own task (e.g. tell a + queue consumer to stop pulling new work) before that task gets cancelled; ``close()`` runs last so both the hooks and the cancelled tasks still have working database connections to write any final state. diff --git a/tests/test_shutdown.py b/tests/test_shutdown.py index ae374e0f..b6fb02c9 100644 --- a/tests/test_shutdown.py +++ b/tests/test_shutdown.py @@ -1,7 +1,5 @@ """ -Tests for the shutdown(datasette) plugin hook and Datasette.invoke_shutdown(), -per plans/first-request/04-core-plan.md (decision #6) and -todos/first-request/04-shutdown-hook.md. +Tests for the shutdown(datasette) plugin hook and Datasette.invoke_shutdown(). Order under test: plugin `shutdown` hooks run first (while background tasks are still alive) -> supervised background tasks are cancelled and drained