Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Messenger] Supervisor graceful shutdown #15535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Messenger] Supervisor graceful shutdown
  • Loading branch information
AymDev authored and javiereguiluz committed Jul 20, 2021
commit 79d5a07c5b48987f3c44875dafe44027f9c23b20
20 changes: 20 additions & 0 deletions 20 messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,25 @@ config and start your workers:

See the `Supervisor docs`_ for more details.

Graceful Shutdown
~~~~~~~~~~~~~~~~~

Workers can handle the ``SIGTERM`` POSIX signal to finish handling their
current message before exiting, as long as the `PCNTL`_ extension is installed.

.. tip::

In some cases the ``SIGTERM`` signal is sent by Supervisor itself (e.g.
AymDev marked this conversation as resolved.
Show resolved Hide resolved
stopping a Docker container having Supervisor as its entrypoint).
In these cases you need to add a ``stopwaitsecs`` key to the program
configuration (with a value of the desired grace period in seconds)
in order to perform a graceful shutdown.
AymDev marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: ini

[program:x]
stopwaitsecs=20

.. _messenger-retries-failures:

Retries & Failures
Expand Down Expand Up @@ -1747,4 +1766,5 @@ Learn more
.. _`Enqueue's transport`: https://github.com/sroze/messenger-enqueue-transport
.. _`streams`: https://redis.io/topics/streams-intro
.. _`Supervisor docs`: http://supervisord.org/
.. _`PCNTL`: https://www.php.net/manual/book.pcntl.php
.. _`SymfonyCasts' message serializer tutorial`: https://symfonycasts.com/screencast/messenger/transport-serializer
Morty Proxy This is a proxified and sanitized view of the page, visit original site.