Skip to content

Commit 27d17c7

Browse files
bartloopauvipy
authored andcommitted
Add doc warnings to ensure devs understand backend resource usage (celery#4718)
* Add warnings to ensure developers understand they must process task return values to avoid resource issues. Specifically, the resource being consumed is redis subscriptions. Unsubscribe does not occur unless the caller explicitly cleans it up. * Remove training whitespace to pass flake check
1 parent 5e2689d commit 27d17c7

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

celery/result.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ def get(self, timeout=None, propagate=True, interval=0.5,
152152
Waiting for tasks within a task may lead to deadlocks.
153153
Please read :ref:`task-synchronous-subtasks`.
154154
155+
Warning:
156+
Backends use resources to store and transmit results. To ensure
157+
that resources are released, you must eventually call
158+
:meth:`[email protected]` or :meth:`[email protected]` on
159+
EVERY :class:`~@AsyncResult` instance returned after calling
160+
a task.
161+
155162
Arguments:
156163
timeout (float): How long to wait, in seconds, before the
157164
operation times out.

docs/getting-started/first-steps-with-celery.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,14 @@ original traceback:
271271
.. code-block:: pycon
272272
273273
>>> result.traceback
274-
274+
275+
.. warning::
276+
277+
Backends use resources to store and transmit results. To ensure
278+
that resources are released, you must eventually call
279+
:meth:`[email protected]` or :meth:`[email protected]` on
280+
EVERY :class:`~@AsyncResult` instance returned after calling
281+
a task.
275282

276283
See :mod:`celery.result` for the complete result object reference.
277284

docs/userguide/tasks.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,14 @@ No backend works well for every use case.
10451045
You should read about the strengths and weaknesses of each backend, and choose
10461046
the most appropriate for your needs.
10471047

1048+
.. warning::
1049+
1050+
Backends use resources to store and transmit results. To ensure
1051+
that resources are released, you must eventually call
1052+
:meth:`[email protected]` or :meth:`[email protected]` on
1053+
EVERY :class:`~@AsyncResult` instance returned after calling
1054+
a task.
1055+
10481056
.. seealso::
10491057

10501058
:ref:`conf-result-backend`

0 commit comments

Comments
 (0)