File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Filter options
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:
653
653
654
654
See the `Supervisor docs `_ for more details.
655
655
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
+
656
675
.. _messenger-retries-failures :
657
676
658
677
Retries & Failures
@@ -1747,4 +1766,5 @@ Learn more
1747
1766
.. _`Enqueue's transport` : https://github.com/sroze/messenger-enqueue-transport
1748
1767
.. _`streams` : https://redis.io/topics/streams-intro
1749
1768
.. _`Supervisor docs` : http://supervisord.org/
1769
+ .. _`PCNTL` : https://www.php.net/manual/book.pcntl.php
1750
1770
.. _`SymfonyCasts' message serializer tutorial` : https://symfonycasts.com/screencast/messenger/transport-serializer
You can’t perform that action at this time.
0 commit comments