Skip to content

Commit

Permalink
immediately return from RMQ starting
Browse files Browse the repository at this point in the history
This improves UX, with the slight risk
of having it fail immediately without
noticing right away.

CMK-21190

Change-Id: Iba891076fb7a2ad2493cbd9ef35d57889e731fd5
  • Loading branch information
mo-ki committed Feb 13, 2025
1 parent 6f7bd2f commit ce57d3e
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions omd/packages/rabbitmq/skel/etc/init.d/rabbitmq
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,15 @@ await_process_stop() {
return 1
}

rabbitmq_accepting_connections() {
"${RABBITMQ_DIAGNOSTICS}" check_port_listener --node "${RABBITMQ_NODENAME}" "${RABBITMQ_PORT}"
# no idea why we can't use this anymore; it will fail for the management plugin
# "${RABBITMQ_DIAGNOSTICS}" check_port_connectivity --node "${RABBITMQ_NODENAME}"
}

await_process_start() {
# Only write output in the end, otherwise we clobber the logfile.
max=$(("${1}" * 10))
# If the PIDFILE gets filled, rabbitmq started
for N in $(seq "${max}"); do
[ -s "${PIDFILE}" ] && rabbitmq_accepting_connections &>/dev/null && break
[ -e "${PIDFILE}" ] || {
date +"%F %T.%N RabbitMQ failed to start (pidfile vanished)"
return 1
}
[ $((N % 10)) -eq 0 ] && printf "."
[ -s "${PIDFILE}" ] && return 0
[ -e "${PIDFILE}" ] || return 1
sleep 0.1
done

# once again, mostly to get the output of the diagnostics call
[ -s "${PIDFILE}" ] && rabbitmq_accepting_connections && {
date +"%F %T.%N RabbitMQ considered ready"
return 0
}

date +"%F %T.%N RabbitMQ failed to start (giving up after timeout)"
return 1
}

Expand Down

0 comments on commit ce57d3e

Please sign in to comment.