We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2434bfe commit 509fb26Copy full SHA for 509fb26
CHANGES/8267.doc.rst
@@ -0,0 +1 @@
1
+Added a note about canceling tasks to avoid delaying server shutdown -- by :user:`Dreamsorcerer`.
docs/web_advanced.rst
@@ -956,6 +956,14 @@ steps 4 and 7).
956
:ref:`cleanup contexts<aiohttp-web-cleanup-ctx>`.
957
7. Cancel any remaining tasks and wait on them to complete.
958
959
+.. note::
960
+
961
+ When creating new tasks in a handler which _should_ be cancelled on server shutdown,
962
+ then it is important to keep track of those tasks and explicitly cancel them in a
963
+ :attr:`Application.on_shutdown` callback. As we can see from the above steps,
964
+ without this the server will wait on those new tasks to complete before it continues
965
+ with server shutdown.
966
967
Websocket shutdown
968
^^^^^^^^^^^^^^^^^^
969
0 commit comments