File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -653,6 +653,25 @@ config and start your workers:
653653
654654 See the `Supervisor docs `_ for more details.
655655
656+ Graceful Shutdown
657+ ~~~~~~~~~~~~~~~~~
658+
659+ Workers can handle the ``SIGTERM `` POSIX signal to finish handling their
660+ current message before exiting, as long as the `PCNTL `_ extension is installed.
661+
662+ .. tip ::
663+
664+ In some cases the ``SIGTERM `` signal is sent by Supervisor itself (e.g.
665+ stopping a Docker container having Supervisor as its entrypoint).
666+ In these cases you need to add a ``stopwaitsecs `` key to the program
667+ configuration (with a value of the desired grace period in seconds)
668+ in order to perform a graceful shutdown.
669+
670+ .. code-block :: ini
671+
672+ [program:x]
673+ stopwaitsecs =20
674+
656675 .. _messenger-retries-failures :
657676
658677Retries & Failures
@@ -1747,4 +1766,5 @@ Learn more
17471766.. _`Enqueue's transport` : https://github.com/sroze/messenger-enqueue-transport
17481767.. _`streams` : https://redis.io/topics/streams-intro
17491768.. _`Supervisor docs` : http://supervisord.org/
1769+ .. _`PCNTL` : https://www.php.net/manual/book.pcntl.php
17501770.. _`SymfonyCasts' message serializer tutorial` : https://symfonycasts.com/screencast/messenger/transport-serializer
You can’t perform that action at this time.
0 commit comments