diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2017-03-22 02:42:46 +0300 |
|---|---|---|
| committer | Michael Klishin <mklishin@pivotal.io> | 2017-03-22 02:42:46 +0300 |
| commit | c0ad88e6c2ad34a216733eb9f766911ff9669f80 (patch) | |
| tree | 176bf4dfc0412b20d037d8582de5867598e5bb48 /src/rabbit.erl | |
| parent | 5565bb9320656533ad1fea78a8c6d2ff57b4a3e1 (diff) | |
| download | rabbitmq-server-git-c0ad88e6c2ad34a216733eb9f766911ff9669f80.tar.gz | |
Register with peer discovery backend on start if the backend supports it
This introduces a new function to the peer discovery interface.
The idea is to let backends indicate if they support registration.
The goal is not to avoid calling the function, since Erlang
behaviours require all functions to be implemented anyway.
What we are trying to avoid with this is extra log entries
that say "[un]registering with ..." as they can be confusing
e.g. in single node installations.
References #1143.
Diffstat (limited to 'src/rabbit.erl')
| -rw-r--r-- | src/rabbit.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index be75321714..f510985deb 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -327,7 +327,9 @@ broker_start() -> ToBeLoaded = Plugins ++ ?APPS, start_apps(ToBeLoaded), maybe_sd_notify(), - ok = log_broker_started(rabbit_plugins:strictly_plugins(rabbit_plugins:active())). + ok = log_broker_started(rabbit_plugins:strictly_plugins(rabbit_plugins:active())), + rabbit_peer_discovery:maybe_register(), + ok. %% Try to send systemd ready notification if it makes sense in the %% current environment. standard_error is used intentionally in all @@ -472,7 +474,7 @@ stop() -> rabbit_log:info("RabbitMQ is asked to stop...~n", []), Apps = ?APPS ++ rabbit_plugins:active(), stop_apps(app_utils:app_dependency_order(Apps, true)), - rabbit_peer_discovery:unregister(), + rabbit_peer_discovery:maybe_unregister(), rabbit_log:info("Successfully stopped RabbitMQ and its dependencies~n", []). stop_and_halt() -> @@ -755,7 +757,7 @@ start(normal, []) -> end. prep_stop(State) -> - rabbit_peer_discovery:unregister(), + rabbit_peer_discovery:maybe_unregister(), State. stop(_State) -> |
