From 84e91a6e33750e2dcc11e179aea77b47bb6b4df5 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 12 Mar 2022 13:40:49 -0800 Subject: [PATCH] configure-rabbitmq: Use rabbitmqctl await_online_nodes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rabbitmqctl ping only checks that the Erlang process is registered with epmd. There’s a window after that where the rabbit app is still starting inside it. Signed-off-by: Anders Kaseorg --- scripts/setup/configure-rabbitmq | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/setup/configure-rabbitmq b/scripts/setup/configure-rabbitmq index e92567eefc..ec459aa462 100755 --- a/scripts/setup/configure-rabbitmq +++ b/scripts/setup/configure-rabbitmq @@ -19,10 +19,14 @@ RABBITMQ_PASSWORD=$("$(dirname "$0")/../get-django-setting" RABBITMQ_PASSWORD) # Wait for RabbitMQ to start up retries=29 -while ! "${sudo[@]}" rabbitmqctl ping -q 2>/dev/null; do +# Could use rabbitmqctl await_startup when we upgrade to 3.7.11. +while ! "${sudo[@]}" rabbitmqctl -q await_online_nodes 1 2>/dev/null; do + if ((retries == 29)); then + echo "Waiting for RabbitMQ to start up..." + fi sleep 1 if ! ((retries -= 1)); then - "${sudo[@]}" rabbitmqctl ping -q + "${sudo[@]}" rabbitmqctl -q await_online_nodes 1 break fi done