summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-08-30 17:38:34 +0100
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-08-30 17:38:34 +0100
commit22f9b9bc211c994a6e76f21ee93025788f60c3cc (patch)
tree62938b905a51eee6158ac3138b822a89e58e88f7 /src
parent9578c4896171a1bef58499542fd3e2a7310557e2 (diff)
downloadrabbitmq-server-git-22f9b9bc211c994a6e76f21ee93025788f60c3cc.tar.gz
matthias doesn't like the nested `set_synchronised' :(
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mirror_queue_slave.erl38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl
index 2c60acf061..58b9b64442 100644
--- a/src/rabbit_mirror_queue_slave.erl
+++ b/src/rabbit_mirror_queue_slave.erl
@@ -817,26 +817,24 @@ process_instruction({set_length, Length, Dropped, AckRequired},
QLen = BQ:len(BQS),
ToDrop = QLen - Length,
{ok,
- set_synchronised(
- Length,
- case ToDrop >= 0 of
- true ->
- State1 =
- lists:foldl(
- fun (const, StateN = #state{backing_queue_state = BQSN}) ->
- {{#basic_message{id = MsgId}, _, AckTag, _},
- BQSN1} = BQ:fetch(AckRequired, BQSN),
- maybe_store_ack(
- AckRequired, MsgId, AckTag,
- StateN #state { backing_queue_state = BQSN1 })
- end, State, lists:duplicate(ToDrop, const)),
- case AckRequired of
- true -> set_synchronised(ToDrop, Dropped, Length, State1);
- false -> State1
- end;
- false ->
- State
- end)};
+ case ToDrop >= 0 of
+ true ->
+ State1 =
+ lists:foldl(
+ fun (const, StateN = #state{backing_queue_state = BQSN}) ->
+ {{#basic_message{id = MsgId}, _, AckTag, _}, BQSN1} =
+ BQ:fetch(AckRequired, BQSN),
+ maybe_store_ack(
+ AckRequired, MsgId, AckTag,
+ StateN #state { backing_queue_state = BQSN1 })
+ end, State, lists:duplicate(ToDrop, const)),
+ case AckRequired of
+ true -> set_synchronised(ToDrop, Dropped, Length, State1);
+ false -> set_synchronised(Length, State1)
+ end;
+ false ->
+ set_synchronised(Length, State)
+ end};
process_instruction({fetch, AckRequired, MsgId, Remaining},
State = #state { backing_queue = BQ,
backing_queue_state = BQS,