configure-rabbitmq: Use rabbitmqctl ping.

Our supported distributions now all have RabbitMQ ≥ 3.7.8.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-02-11 16:09:04 -08:00 committed by Tim Abbott
parent 56518e094c
commit d1241be496
1 changed files with 2 additions and 6 deletions

View File

@ -18,15 +18,11 @@ RABBITMQ_USERNAME=$("$(dirname "$0")/../get-django-setting" RABBITMQ_USERNAME)
RABBITMQ_PASSWORD=$("$(dirname "$0")/../get-django-setting" RABBITMQ_PASSWORD)
# Wait for RabbitMQ to start up
try_ping() {
# `rabbitmqctl ping` requires 3.7.6 or newer
out="$("${sudo[@]}" rabbitmqctl eval 'net_adm:ping(node()).')" && [ "$out" = 'pong' ]
}
retries=29
while ! try_ping 2>/dev/null; do
while ! "${sudo[@]}" rabbitmqctl ping -q 2>/dev/null; do
sleep 1
if ! ((retries -= 1)); then
try_ping
"${sudo[@]}" rabbitmqctl ping -q
break
fi
done