From 7805b074f0d08ad5b7fd351f1d8ca912ddeba110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 10 Sep 2025 18:41:44 +0200 Subject: [PATCH] Handle consumer exit status in compose.yaml Updated the `messenger:consume` command in `compose.yaml` to run as the `PHP_FPM_USER` and added error handling to stop the container if the consumer exits with a non-zero status. --- templates/compose.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/compose.yaml b/templates/compose.yaml index ca16739..33fc811 100644 --- a/templates/compose.yaml +++ b/templates/compose.yaml @@ -53,7 +53,12 @@ services: sleep 3 && bin/console cache:clear && while ! [ -f /tmp/kill_me ]; do - php -d memory_limit=2G bin/console messenger:consume priority async --limit=20 --time-limit=600 -v; + su -s /bin/bash -c 'php -d memory_limit=2G bin/console messenger:consume priority async --limit=20 --time-limit=600 -v' "$PHP_FPM_USER"; + rc=$?; + if [ $rc -ne 0 ]; then + echo "Consumer exited with status $rc. Stopping container."; + exit $rc; + fi done; pre_stop: - command: