Skip to content

Commit

Permalink
docs for terminate container when celery worker process shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ApostolFet committed Nov 30, 2024
1 parent 99c3391 commit 830b69d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/integrations/celery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,20 @@ or for one task handler
):
...
6. (optional) Setup signal to close container when worker process shutdown

6. Setup dishka integration
.. code-block:: python
from celery import current_app
from celery.signals import worker_process_shutdown
from dishka import Container
@worker_process_shutdown.connect()
def close_dishka(*args, **kwargs):
container: Container = current_app.conf["dishka_container"]
container.close()
7. Setup dishka integration

.. code-block:: python
Expand Down

0 comments on commit 830b69d

Please sign in to comment.