rabbitmq-run.mk: Stop node in `start-background-broker` in case of error
[Why] The CLI sometimes crashes early because it fails to configure the Erlang distribution. Because we use two CLI commands to watch the start of RabbitMQ, if one of them fails, the Make recipe will exit with an error, leaving the RabbitMQ node running. [How] We use a shell trap to stop the node if the shell is about to exit with an error. While here, we retry the `await_startup` CLI command several times because this is the one failing the most. This is until the crash is understood and a proper fix is committed.
This commit is contained in:
parent
0e7f92aba2
commit
3a278e7e7c
|
@ -323,10 +323,13 @@ start-background-broker: node-tmpdir $(DIST_TARGET)
|
|||
$(BASIC_SCRIPT_ENV_SETTINGS) \
|
||||
$(RABBITMQ_SERVER) \
|
||||
$(REDIRECT_STDIO) &
|
||||
trap 'test "$$?" = 0 || $(MAKE) stop-node' EXIT && \
|
||||
ERL_LIBS="$(DIST_ERL_LIBS)" \
|
||||
$(RABBITMQCTL) -n $(RABBITMQ_NODENAME) wait --timeout $(RMQCTL_WAIT_TIMEOUT) $(RABBITMQ_PID_FILE) && \
|
||||
ERL_LIBS="$(DIST_ERL_LIBS)" \
|
||||
$(RABBITMQCTL) --node $(RABBITMQ_NODENAME) await_startup
|
||||
for i in $$(seq 1 10); do \
|
||||
ERL_LIBS="$(DIST_ERL_LIBS)" $(RABBITMQCTL) -n $(RABBITMQ_NODENAME) await_startup || sleep 1; \
|
||||
done && \
|
||||
ERL_LIBS="$(DIST_ERL_LIBS)" $(RABBITMQCTL) -n $(RABBITMQ_NODENAME) await_startup
|
||||
|
||||
start-rabbit-on-node:
|
||||
$(exec_verbose) ERL_LIBS="$(DIST_ERL_LIBS)" \
|
||||
|
|
Loading…
Reference in New Issue