Skip to content

Commit 883307e

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: [Messenger] Supervisor graceful shutdown
2 parents f09ea9e + 1ed8250 commit 883307e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

messenger.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,23 @@ Next, tell Supervisor to read your config and start your workers:
657657
658658
See the `Supervisor docs`_ for more details.
659659

660+
Graceful Shutdown
661+
~~~~~~~~~~~~~~~~~
662+
663+
If you install the `PCNTL`_ PHP extension in your project, workers will handle
664+
the ``SIGTERM`` POSIX signal to finish processing their current message before
665+
exiting.
666+
667+
In some cases the ``SIGTERM`` signal is sent by Supervisor itself (e.g. stopping
668+
a Docker container having Supervisor as its entrypoint). In these cases you
669+
need to add a ``stopwaitsecs`` key to the program configuration (with a value
670+
of the desired grace period in seconds) in order to perform a graceful shutdown:
671+
672+
.. code-block:: ini
673+
674+
[program:x]
675+
stopwaitsecs=20
676+
660677
.. _messenger-retries-failures:
661678

662679
Retries & Failures
@@ -2020,6 +2037,7 @@ Learn more
20202037
.. _`Enqueue's transport`: https://github.com/sroze/messenger-enqueue-transport
20212038
.. _`streams`: https://redis.io/topics/streams-intro
20222039
.. _`Supervisor docs`: http://supervisord.org/
2040+
.. _`PCNTL`: https://www.php.net/manual/book.pcntl.php
20232041
.. _`SymfonyCasts' message serializer tutorial`: https://symfonycasts.com/screencast/messenger/transport-serializer
20242042
.. _`Long polling`: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html
20252043
.. _`Visibility Timeout`: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html

0 commit comments

Comments
 (0)