summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-12-03 14:26:14 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-12-03 14:26:14 +0000
commit95df21c84139e849fa1fb836b17020fa1ae26f04 (patch)
tree0985fd3ea45785d4196c9bb54647a41b281e77f5
parent5c23d01c49572a8c1b9a4d732461d3db26beee45 (diff)
downloadrabbitmq-server-bug25335.tar.gz
get rid of last remaining cross-node fun in rabbit_amqqueuebug25335
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.
-rw-r--r--src/rabbit_amqqueue.erl25
1 files 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.