summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-06-05 17:11:54 +0100
committerSimon MacMullen <simon@rabbitmq.com>2014-06-05 17:11:54 +0100
commitc57a0236fc2ec7cdd96f5abd7a3f18d1e4282a59 (patch)
treee340720d8d2c38f05639c800b52859f9fc233ce2
parent7d6c1d8b723a84b8b242fc8d1ff6cbb281a15d24 (diff)
downloadrabbitmq-server-c57a0236fc2ec7cdd96f5abd7a3f18d1e4282a59.tar.gz
Oops, we do need sync_notify - reinstate it.
-rw-r--r--src/rabbit_event.erl21
-rw-r--r--src/rabbit_plugins.erl5
2 files changed, 21 insertions, 5 deletions
diff --git a/src/rabbit_event.erl b/src/rabbit_event.erl
index b867223b..a33103fd 100644
--- a/src/rabbit_event.erl
+++ b/src/rabbit_event.erl
@@ -23,6 +23,7 @@
ensure_stats_timer/3, stop_stats_timer/2, reset_stats_timer/2]).
-export([stats_level/2, if_enabled/3]).
-export([notify/2, notify/3, notify_if/3]).
+-export([sync_notify/2, sync_notify/3]).
%%----------------------------------------------------------------------------
@@ -61,6 +62,9 @@
-spec(notify/2 :: (event_type(), event_props()) -> 'ok').
-spec(notify/3 :: (event_type(), event_props(), reference() | 'none') -> 'ok').
-spec(notify_if/3 :: (boolean(), event_type(), event_props()) -> 'ok').
+-spec(sync_notify/2 :: (event_type(), event_props()) -> 'ok').
+-spec(sync_notify/3 :: (event_type(), event_props(),
+ reference() | 'none') -> 'ok').
-endif.
@@ -145,7 +149,16 @@ notify_if(false, _Type, _Props) -> ok.
notify(Type, Props) -> notify(Type, Props, none).
notify(Type, Props, Ref) ->
- gen_event:notify(?MODULE, #event{type = Type,
- props = Props,
- reference = Ref,
- timestamp = os:timestamp()}).
+ gen_event:notify(?MODULE, event_cons(Type, Props, Ref)).
+
+sync_notify(Type, Props) -> sync_notify(Type, Props, none).
+
+sync_notify(Type, Props, Ref) ->
+ gen_event:sync_notify(?MODULE, event_cons(Type, Props, Ref)).
+
+event_cons(Type, Props, Ref) ->
+ #event{type = Type,
+ props = Props,
+ reference = Ref,
+ timestamp = os:timestamp()}.
+
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index f6860424..2dffa669 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -47,7 +47,10 @@ disable(Plugins) ->
RunningApps = rabbit_misc:which_applications(),
ToDisable = [P || P <- Plugins,
proplists:is_defined(P, RunningApps)],
- ok = rabbit_event:notify(plugins_changed, [{disabled, ToDisable}]),
+ %% We need sync_notify here since mgmt will attempt to look at all
+ %% the modules for the disabled plugins - if they are unloaded
+ %% that won't work.
+ ok = rabbit_event:sync_notify(plugins_changed, [{disabled, ToDisable}]),
rabbit:stop_apps(ToDisable).
%% @doc Prepares the file system and installs all enabled plugins.