summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-04-10 21:19:46 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2012-04-10 21:19:46 +0100
commitf1719addbe1c0d7e0f9fbcf2ce8445a2841e80c8 (patch)
treea6bc05e625d72ce8f7e7089166d24f2212d5d3c1 /src
parent8225d8f7d81e2f130f5664bc73eb94162a5f4377 (diff)
downloadrabbitmq-server-f1719addbe1c0d7e0f9fbcf2ce8445a2841e80c8.tar.gz
optimisation: gm:broadcast earlier so other nodes can get on with work
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mirror_queue_master.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rabbit_mirror_queue_master.erl b/src/rabbit_mirror_queue_master.erl
index bfdab487..cd9dabc4 100644
--- a/src/rabbit_mirror_queue_master.erl
+++ b/src/rabbit_mirror_queue_master.erl
@@ -179,9 +179,9 @@ dropwhile(Pred, MsgFun,
backing_queue_state = BQS }) ->
Len = BQ:len(BQS),
BQS1 = BQ:dropwhile(Pred, MsgFun, BQS),
+ ok = gm:broadcast(GM, {set_length, BQ:len(BQS1)}),
Dropped = Len - BQ:len(BQS1),
SetDelivered1 = lists:max([0, SetDelivered - Dropped]),
- ok = gm:broadcast(GM, {set_length, BQ:len(BQS1)}),
State #state { backing_queue_state = BQS1,
set_delivered = SetDelivered1 }.
@@ -241,11 +241,11 @@ ack(AckTags, State = #state { gm = GM,
backing_queue_state = BQS,
ack_msg_id = AM }) ->
{MsgIds, BQS1} = BQ:ack(AckTags, BQS),
- AM1 = lists:foldl(fun dict:erase/2, AM, AckTags),
case MsgIds of
[] -> ok;
_ -> ok = gm:broadcast(GM, {ack, MsgIds})
end,
+ AM1 = lists:foldl(fun dict:erase/2, AM, AckTags),
{MsgIds, State #state { backing_queue_state = BQS1,
ack_msg_id = AM1 }}.