summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2014-03-03 15:07:54 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2014-03-03 15:07:54 +0000
commita6406fd928d54f7751725312319ba47ad00641b6 (patch)
treeae8a8f367cf10a3d4ef163911da8cb7455994845 /src
parentb86c0f50bc584b8e1912226af2701db672fc8c4f (diff)
downloadrabbitmq-server-git-a6406fd928d54f7751725312319ba47ad00641b6.tar.gz
clamp duration to infinity when all rates are very low
...so that the memory monitor excludes the queue from avg duration calculations, which would otherwise get massively skewed.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_variable_queue.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 73e9f6b567..995c73192c 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -801,8 +801,9 @@ ram_duration(State) ->
RamAckCount = gb_trees:size(RPA),
Duration = %% msgs+acks / (msgs+acks/sec) == sec
- case (AvgEgressRate == 0 andalso AvgIngressRate == 0 andalso
- AvgAckEgressRate == 0 andalso AvgAckIngressRate == 0) of
+ case lists:all(fun (X) -> X < 0.01 end,
+ [AvgEgressRate, AvgIngressRate,
+ AvgAckEgressRate, AvgAckIngressRate]) of
true -> infinity;
false -> (RamMsgCountPrev + RamMsgCount +
RamAckCount + RamAckCountPrev) /