summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Harrop <rob@rabbitmq.com>2010-10-19 10:52:47 +0100
committerRob Harrop <rob@rabbitmq.com>2010-10-19 10:52:47 +0100
commit833d58cb7e08dd839f2f470eefea83955ca57fe6 (patch)
tree54220cee39eb8932a9805ec14f4324ebf4a415e9
parentb045fefb25ab3d7330ed8b35f072c9a1f0d6a22b (diff)
downloadrabbitmq-server-833d58cb7e08dd839f2f470eefea83955ca57fe6.tar.gz
Removed extra call to set_ram_duration_target during ram_duration. As such, duration_target is no longer needed in vqstate
-rw-r--r--src/rabbit_variable_queue.erl29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index cbc71bcc..fef44037 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -229,7 +229,6 @@
len,
persistent_count,
- duration_target,
target_ram_msg_count,
ram_msg_count,
ram_msg_count_prev,
@@ -315,7 +314,6 @@
persistent_count :: non_neg_integer(),
transient_threshold :: non_neg_integer(),
- duration_target :: number() | 'infinity',
target_ram_msg_count :: non_neg_integer() | 'infinity',
ram_msg_count :: non_neg_integer(),
ram_msg_count_prev :: non_neg_integer(),
@@ -417,7 +415,6 @@ init(QueueName, IsDurable, Recover) ->
len = DeltaCount1,
persistent_count = DeltaCount1,
- duration_target = infinity,
target_ram_msg_count = infinity,
ram_msg_count = 0,
ram_msg_count_prev = 0,
@@ -662,8 +659,7 @@ set_ram_duration_target(DurationTarget,
infinity -> infinity;
_ -> trunc(DurationTarget * Rate) %% msgs = sec * msgs/sec
end,
- State1 = State #vqstate { target_ram_msg_count = TargetRamMsgCount1,
- duration_target = DurationTarget },
+ State1 = State #vqstate { target_ram_msg_count = TargetRamMsgCount1 },
a(case TargetRamMsgCount1 == infinity orelse
(TargetRamMsgCount =/= infinity andalso
TargetRamMsgCount1 >= TargetRamMsgCount) of
@@ -678,7 +674,6 @@ ram_duration(State = #vqstate {
in_counter = InCount,
out_counter = OutCount,
ram_msg_count = RamMsgCount,
- duration_target = DurationTarget,
ram_msg_count_prev = RamMsgCountPrev }) ->
Now = now(),
{AvgEgressRate, Egress1} = update_rate(Now, Timestamp, OutCount, Egress),
@@ -691,18 +686,16 @@ ram_duration(State = #vqstate {
(2 * (AvgEgressRate + AvgIngressRate))
end,
- {Duration, set_ram_duration_target(
- DurationTarget,
- State #vqstate {
- rates = Rates #rates {
- egress = Egress1,
- ingress = Ingress1,
- avg_egress = AvgEgressRate,
- avg_ingress = AvgIngressRate,
- timestamp = Now },
- in_counter = 0,
- out_counter = 0,
- ram_msg_count_prev = RamMsgCount })}.
+ {Duration, State #vqstate {
+ rates = Rates #rates {
+ egress = Egress1,
+ ingress = Ingress1,
+ avg_egress = AvgEgressRate,
+ avg_ingress = AvgIngressRate,
+ timestamp = Now },
+ in_counter = 0,
+ out_counter = 0,
+ ram_msg_count_prev = RamMsgCount }}.
needs_idle_timeout(State = #vqstate { on_sync = ?BLANK_SYNC }) ->
{Res, _State} = reduce_memory_use(fun (_Quota, State1) -> State1 end,