diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2014-01-30 12:47:58 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2014-01-30 12:47:58 +0000 |
| commit | 60ad234dbb3fb4636cc6632fa107ac7c8393e0b9 (patch) | |
| tree | 59291af55aad432550a8cefe70352c9c1e3ed7e7 | |
| parent | 01e93a9e8619ea1469eabdf90440117f790914a2 (diff) | |
| download | rabbitmq-server-git-60ad234dbb3fb4636cc6632fa107ac7c8393e0b9.tar.gz | |
inline
| -rw-r--r-- | src/rabbit_variable_queue.erl | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index 9a9cb37240..09d56c1c10 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, |
