summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2014-01-30 12:47:58 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2014-01-30 12:47:58 +0000
commitba6c5bec1693585c7ee67ce8d1a4ab76f77fbec5 (patch)
tree59291af55aad432550a8cefe70352c9c1e3ed7e7
parent5e4fe3ae39437cced587745f36cefd1460e79808 (diff)
downloadrabbitmq-server-bug25888.tar.gz
inlinebug25888
-rw-r--r--src/rabbit_variable_queue.erl25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 9a9cb372..09d56c1c 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -543,15 +543,18 @@ publish(Msg = #basic_message { is_persistent = IsPersistent, id = MsgId },
false -> State1 #vqstate { q1 = ?QUEUE:in(m(MsgStatus1), Q1) };
true -> State1 #vqstate { q4 = ?QUEUE:in(m(MsgStatus1), Q4) }
end,
- PCount1 = PCount + one_if(IsPersistent1),
+ InCount1 = InCount + 1,
+ PCount1 = PCount + one_if(IsPersistent1),
UC1 = gb_sets_maybe_insert(NeedsConfirming, MsgId, UC),
- a(reduce_memory_use(
- maybe_update_rates(
- inc_ram_msg_count(State2 #vqstate { next_seq_id = SeqId + 1,
- len = Len + 1,
- in_counter = InCount + 1,
- persistent_count = PCount1,
- unconfirmed = UC1 })))).
+ State3 = inc_ram_msg_count(State2 #vqstate { next_seq_id = SeqId + 1,
+ len = Len + 1,
+ in_counter = InCount1,
+ persistent_count = PCount1,
+ unconfirmed = UC1 }),
+ a(reduce_memory_use(case InCount1 > ?MSGS_PER_RATE_CALC of
+ true -> update_rates(State3);
+ false -> State3
+ end)).
publish_delivered(Msg = #basic_message { is_persistent = IsPersistent,
id = MsgId },
@@ -720,12 +723,6 @@ set_ram_duration_target(
false -> reduce_memory_use(State1)
end).
-maybe_update_rates(State = #vqstate { in_counter = InCount }) ->
- case InCount > ?MSGS_PER_RATE_CALC of
- true -> update_rates(State);
- false -> State
- end.
-
update_rates(State = #vqstate{ in_counter = InCount,
out_counter = OutCount,
ack_in_counter = AckInCount,