diff options
| -rw-r--r-- | src/rabbit_memory_monitor.erl | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/rabbit_memory_monitor.erl b/src/rabbit_memory_monitor.erl index 2fc983b4f4..f2d1e9ca75 100644 --- a/src/rabbit_memory_monitor.erl +++ b/src/rabbit_memory_monitor.erl @@ -242,7 +242,7 @@ internal_update(State = #state{memory_limit = Limit, queue_duration_count = Count}) -> MemoryRatio = erlang:memory(total) / Limit, DesiredDurationAvg1 = - case MemoryRatio < ?LIMIT_THRESHOLD of + case MemoryRatio < ?LIMIT_THRESHOLD orelse Count == 0 of true -> infinity; false -> @@ -250,10 +250,7 @@ internal_update(State = #state{memory_limit = Limit, true -> Sum + ?SUM_INC_AMOUNT; false -> Sum end, - case Count == 0 of - true -> infinity; - false -> (Sum1 / Count) / MemoryRatio - end + (Sum1 / Count) / MemoryRatio end, State1 = State#state{desired_duration = DesiredDurationAvg1}, |
