Skip to content

Commit 1a7239c

Browse files
authored
PYTHON-4745 - Update Async Cancellation documentation (mongodb#2141)
1 parent b94dd8e commit 1a7239c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/async-tutorial.rst

+7
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,10 @@ the collection:
420420
DuplicateKeyError: E11000 duplicate key error index: test_database.profiles.$user_id_1 dup key: { : 212 }
421421
422422
.. seealso:: The MongoDB documentation on `indexes <https://www.mongodb.com/docs/manual/indexes/>`_
423+
424+
Task Cancellation
425+
-----------------
426+
`Cancelling <https://docs.python.org/3/library/asyncio-task.html#task-cancellation>`_ an asyncio Task
427+
that is running a PyMongo operation is treated as a fatal interrupt. Any connections, cursors, and transactions
428+
involved in a cancelled Task will be safely closed and cleaned up as part of the cancellation. If those resources are
429+
also used elsewhere, attempting to utilize them after the cancellation will result in an error.

0 commit comments

Comments
 (0)