mirror of https://github.com/zulip/zulip.git
configure-rabbitmq: Wait for RabbitMQ to start up.
Fixes an occasional failure in ‘vagrant up --provision’. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
f16aa8f264
commit
16aa48d9b2
|
@ -17,6 +17,20 @@ fi
|
|||
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="$("${rabbitmqctl[@]}" eval 'net_adm:ping(node()).')" && [ "$out" = 'pong' ]
|
||||
}
|
||||
retries=9
|
||||
while ! try_ping 2>/dev/null; do
|
||||
sleep 1
|
||||
if ! ((retries -= 1)); then
|
||||
try_ping
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
"${rabbitmqctl[@]}" delete_user "$RABBITMQ_USERNAME" || true
|
||||
"${rabbitmqctl[@]}" delete_user zulip || true
|
||||
"${rabbitmqctl[@]}" delete_user guest || true
|
||||
|
|
Loading…
Reference in New Issue