diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/file_handle_cache.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_msg_store.erl | 6 | ||||
| -rw-r--r-- | src/supervisor2.erl | 29 |
3 files changed, 16 insertions, 21 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index b5b07ecab1..27d24b5dac 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -1079,7 +1079,7 @@ reduce(State = #fhc_state { open_pending = OpenPending, timer_ref = TRef }) -> Now = now(), {CStates, Sum, ClientCount} = - dict:fold(fun (Pid, Eldest, {CStatesAcc, SumAcc, CountAcc} = Accs) -> + dict:fold(fun (Pid, Eldest, {CStatesAcc, SumAcc, CountAcc} = A<ccs) -> [#cstate { pending_closes = PendingCloses, opened = Opened, blocked = Blocked } = CState] = diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index 5fec26591c..e0f05275f5 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -24,11 +24,11 @@ write/3, read/2, contains/2, remove/2, release/2, sync/3]). -export([set_maximum_since_use/2, has_readers/2, combine_files/3, - delete_file/2]). %% internal + delete_file/2]). %% internal -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, - code_change/3, prioritise_call/3, prioritise_cast/2, - prioritise_info/2]). + code_change/3, prioritise_call/3, prioritise_cast/2, + prioritise_info/2]). %%---------------------------------------------------------------------------- diff --git a/src/supervisor2.erl b/src/supervisor2.erl index 1a240856ce..d1537f261e 100644 --- a/src/supervisor2.erl +++ b/src/supervisor2.erl @@ -73,7 +73,6 @@ %% Internal exports -export([init/1, handle_call/3, handle_info/2, terminate/2, code_change/3]). -export([handle_cast/2]). --export([delayed_restart/2]). -define(DICT, dict). @@ -154,9 +153,6 @@ check_childspecs(ChildSpecs) when is_list(ChildSpecs) -> end; check_childspecs(X) -> {error, {badarg, X}}. -delayed_restart(Supervisor, RestartDetails) -> - gen_server:cast(Supervisor, {delayed_restart, RestartDetails}). - %%% --------------------------------------------------- %%% %%% Initialize the supervisor. @@ -352,12 +348,19 @@ handle_call(which_children, _From, State) -> State#state.children), {reply, Resp, State}. +%%% Hopefully cause a function-clause as there is no API function +%%% that utilizes cast. +handle_cast(null, State) -> + error_logger:error_msg("ERROR: Supervisor received cast-message 'null'~n", + []), + + {noreply, State}. -handle_cast({delayed_restart, {RestartType, Reason, Child}}, State) +handle_info({delayed_restart, {RestartType, Reason, Child}}, State) when ?is_simple(State) -> {ok, NState} = do_restart(RestartType, Reason, Child, State), {noreply, NState}; -handle_cast({delayed_restart, {RestartType, Reason, Child}}, State) -> +handle_info({delayed_restart, {RestartType, Reason, Child}}, State) -> case get_child(Child#child.name, State) of {value, Child1} -> {ok, NState} = do_restart(RestartType, Reason, Child1, State), @@ -366,14 +369,6 @@ handle_cast({delayed_restart, {RestartType, Reason, Child}}, State) -> {noreply, State} end; -%%% Hopefully cause a function-clause as there is no API function -%%% that utilizes cast. -handle_cast(null, State) -> - error_logger:error_msg("ERROR: Supervisor received cast-message 'null'~n", - []), - - {noreply, State}. - %% %% Take care of terminated children. %% @@ -536,9 +531,9 @@ do_restart({RestartType, Delay}, Reason, Child, State) -> {ok, NState} -> {ok, NState}; {terminate, NState} -> - {ok, _TRef} = timer:apply_after( - trunc(Delay*1000), ?MODULE, delayed_restart, - [self(), {{RestartType, Delay}, Reason, Child}]), + _TRef = erlang:send_after(trunc(Delay*1000), self(), + {delayed_restart, + {{RestartType, Delay}, Reason, Child}}), {ok, state_del_child(Child, NState)} end; do_restart(permanent, Reason, Child, State) -> |
