configure-rabbitmq: Use rabbitmqctl await_online_nodes.

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 <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-03-12 13:40:49 -08:00 committed by Alex Vandiver
parent 52d363cada
commit 84e91a6e33
1 changed files with 6 additions and 2 deletions

View File

@ -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