We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eaddd9c commit 3a13bd5Copy full SHA for 3a13bd5
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
@@ -952,6 +952,14 @@ steps 4 and 7).
952
:ref:`cleanup contexts<aiohttp-web-cleanup-ctx>`.
953
7. Cancel any remaining tasks and wait on them to complete.
954
955
+.. note::
956
+
957
+ When creating new tasks in a handler which _should_ be cancelled on server shutdown,
958
+ then it is important to keep track of those tasks and explicitly cancel them in a
959
+ :attr:`Application.on_shutdown` callback. As we can see from the above steps,
960
+ without this the server will wait on those new tasks to complete before it continues
961
+ with server shutdown.
962
963
Websocket shutdown
964
^^^^^^^^^^^^^^^^^^
965
0 commit comments