summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-09-26 18:07:54 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-09-26 18:07:54 +0100
commitee3419c9ead7ad301fcbc710eda4ca75fe479cdd (patch)
treefa702661b93254762c551b8af7d1b9b3e9731885
parent972b94caf7db1af8a4d2e4266fc9955f84e0b77f (diff)
downloadrabbitmq-server-git-ee3419c9ead7ad301fcbc710eda4ca75fe479cdd.tar.gz
Just one predicate.
-rw-r--r--src/rabbit_memory_monitor.erl17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/rabbit_memory_monitor.erl b/src/rabbit_memory_monitor.erl
index 71a5751194..66c01298e8 100644
--- a/src/rabbit_memory_monitor.erl
+++ b/src/rabbit_memory_monitor.erl
@@ -263,16 +263,13 @@ inform_queues(ShouldInform, DesiredDurationAvg, Durations) ->
%% In normal use, we only inform queues immediately if the desired
%% duration has decreased, we want to ensure timely paging.
-should_inform_predicate(false) -> fun (infinity, infinity) -> false;
- (infinity, _D2) -> true;
- (_D1, infinity) -> false;
- (D1, D2) -> D1 > D2
- end;
+should_inform_predicate(false) -> fun greater_than/2;
%% When the disk alarm has gone off though, we want to inform queues
%% immediately if the desired duration has *increased* - we want to
%% ensure timely stopping paging.
-should_inform_predicate(true) -> fun (infinity, infinity) -> false;
- (infinity, _D2) -> false;
- (_D1, infinity) -> true;
- (D1, D2) -> D1 < D2
- end.
+should_inform_predicate(true) -> fun (D1, D2) -> greater_than(D2, D1) end.
+
+greater_than(infinity, infinity) -> false;
+greater_than(infinity, _D2) -> true;
+greater_than(_D1, infinity) -> false;
+greater_than(D1, D2) -> D1 > D2.