From 95df21c84139e849fa1fb836b17020fa1ae26f04 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 3 Dec 2012 14:26:14 +0000 Subject: get rid of last remaining cross-node fun in rabbit_amqqueue There was no need for the rabbit_misc:with_exit_handler in safe_delegate_call_ok, since the error condition caught be that is also being caught by the check in 'filter'. Getting rid of the superfluous check allows us to just invoke delegate:call and thus get rid of the funs. Plus inline the lot. --- src/rabbit_amqqueue.erl | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index 3b54c1c3..52884410 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -509,9 +509,14 @@ reject(QPid, MsgIds, Requeue, ChPid) -> delegate:cast(QPid, {reject, MsgIds, Requeue, ChPid}). notify_down_all(QPids, ChPid) -> - safe_delegate_call_ok( - fun (QPid) -> gen_server2:call(QPid, {notify_down, ChPid}, infinity) end, - QPids). + {_, Bads} = delegate:call(QPids, {notify_down, ChPid}), + case lists:filter( + fun ({_Pid, {exit, {R, _}, _}}) -> rabbit_misc:is_abnormal_exit(R); + ({_Pid, _}) -> false + end, Bads) of + [] -> ok; + Bads1 -> {error, Bads1} + end. limit_all(QPids, ChPid, Limiter) -> delegate:cast(QPids, {limit, ChPid, Limiter}). @@ -671,17 +676,3 @@ qpids(Qs) -> {[QPid | MPidAcc], [SPids | SPidAcc]} end, {[], []}, Qs), {MPids, lists:append(SPids)}. - -safe_delegate_call_ok(F, Pids) -> - {_, Bads} = delegate:invoke(Pids, fun (Pid) -> - rabbit_misc:with_exit_handler( - fun () -> ok end, - fun () -> F(Pid) end) - end), - case lists:filter( - fun ({_Pid, {exit, {R, _}, _}}) -> rabbit_misc:is_abnormal_exit(R); - ({_Pid, _}) -> false - end, Bads) of - [] -> ok; - Bads1 -> {error, Bads1} - end. -- cgit v1.2.1