summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2018-12-10 11:17:39 +0100
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2018-12-10 11:17:39 +0100
commit3800146d60244c006d21b0cb0c8f5dc3d0768b30 (patch)
tree77e6a757b66e6903dc0b2c47951db05597c2afdd
parentb26b353cd4e654846e4ac8f3e2eebcbdd856bb54 (diff)
downloadrabbitmq-server-git-3800146d60244c006d21b0cb0c8f5dc3d0768b30.tar.gz
rabbit_channel: Import `queue_fold()` from rabbit_misc
... and modify it to use `lqueue`. The copy in `rabbit_misc` assumes the use of regular `queue:queue()`.
-rw-r--r--src/rabbit_channel.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 937e0a4ba3..f749d9f30e 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -1553,7 +1553,7 @@ handle_method(#'tx.commit'{}, _, #ch{tx = none}) ->
handle_method(#'tx.commit'{}, _, State = #ch{tx = {Msgs, Acks},
limiter = Limiter}) ->
- State1 = rabbit_misc:queue_fold(fun deliver_to_queues/2, State, Msgs),
+ State1 = queue_fold(fun deliver_to_queues/2, State, Msgs),
Rev = fun (X) -> lists:reverse(lists:sort(X)) end,
State2 = lists:foldl(fun ({ack, A}, Acc) ->
ack(Rev(A), Acc);
@@ -2548,3 +2548,9 @@ get_operation_timeout_and_deadline() ->
Timeout = ?CHANNEL_OPERATION_TIMEOUT,
Deadline = now_millis() + Timeout,
{Timeout, Deadline}.
+
+queue_fold(Fun, Init, Q) ->
+ case ?QUEUE:out(Q) of
+ {empty, _Q} -> Init;
+ {{value, V}, Q1} -> queue_fold(Fun, Fun(V, Init), Q1)
+ end.