summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2012-01-05 13:34:34 +0000
committerEmile Joubert <emile@rabbitmq.com>2012-01-05 13:34:34 +0000
commitbf6abe68860fe01f6b751dd6c38d30b1a8fcbaae (patch)
treec12e37f0b3f57b9a61dee0652ede445950431d97
parentae29013aec46cda6841f2979001734f99fd60ab3 (diff)
parent3781c15c1c3c035dfeab7d85ba95781ad25c9152 (diff)
downloadrabbitmq-server-bf6abe68860fe01f6b751dd6c38d30b1a8fcbaae.tar.gz
Merged bug24659 into default (2)
-rw-r--r--Makefile2
-rw-r--r--packaging/macports/Portfile.in2
-rw-r--r--src/rabbit_memory_monitor.erl40
3 files changed, 19 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index c799b7f2..31c71dd4 100644
--- a/Makefile
+++ b/Makefile
@@ -56,7 +56,7 @@ endif
#other args: +native +"{hipe,[o3,verbose]}" -Ddebug=true +debug_info +no_strict_record_tests
ERLC_OPTS=-I $(INCLUDE_DIR) -o $(EBIN_DIR) -Wall -v +debug_info $(call boolean_macro,$(USE_SPECS),use_specs) $(call boolean_macro,$(USE_PROPER_QC),use_proper_qc)
-VERSION=0.0.0
+VERSION?=0.0.0
PLUGINS_SRC_DIR?=$(shell [ -d "plugins-src" ] && echo "plugins-src" || echo )
PLUGINS_DIR=plugins
TARBALL_NAME=rabbitmq-server-$(VERSION)
diff --git a/packaging/macports/Portfile.in b/packaging/macports/Portfile.in
index b6dad357..820197e7 100644
--- a/packaging/macports/Portfile.in
+++ b/packaging/macports/Portfile.in
@@ -60,6 +60,8 @@ use_configure no
use_parallel_build yes
+build.env-append HOME=${workpath}
+
destroot.target install_bin
destroot.destdir \
diff --git a/src/rabbit_memory_monitor.erl b/src/rabbit_memory_monitor.erl
index 02f3158f..c25a177b 100644
--- a/src/rabbit_memory_monitor.erl
+++ b/src/rabbit_memory_monitor.erl
@@ -178,11 +178,8 @@ code_change(_OldVsn, State, _Extra) ->
%% Internal functions
%%----------------------------------------------------------------------------
-zero_clamp(Sum) ->
- case Sum < ?EPSILON of
- true -> 0.0;
- false -> Sum
- end.
+zero_clamp(Sum) when Sum < ?EPSILON -> 0.0;
+zero_clamp(Sum) -> Sum.
internal_deregister(Pid, Demonitor,
State = #state { queue_duration_sum = Sum,
@@ -240,26 +237,21 @@ internal_update(State = #state { queue_durations = Durations,
fun (Proc = #process { reported = QueueDuration,
sent = PrevSendDuration,
callback = {M, F, A} }, true) ->
- case (case {QueueDuration, PrevSendDuration} of
- {infinity, infinity} ->
- true;
- {infinity, D} ->
- DesiredDurationAvg1 < D;
- {D, infinity} ->
- DesiredDurationAvg1 < D;
- {D1, D2} ->
- DesiredDurationAvg1 <
- lists:min([D1,D2])
- end) of
- true ->
- ok = erlang:apply(
- M, F, A ++ [DesiredDurationAvg1]),
- ets:insert(
- Durations,
- Proc #process {sent = DesiredDurationAvg1});
- false ->
- true
+ case should_send(QueueDuration, PrevSendDuration,
+ DesiredDurationAvg1) of
+ true -> ok = erlang:apply(
+ M, F, A ++ [DesiredDurationAvg1]),
+ ets:insert(
+ Durations,
+ Proc #process {
+ sent = DesiredDurationAvg1});
+ false -> true
end
end, true, Durations)
end,
State1.
+
+should_send(infinity, infinity, _) -> true;
+should_send(infinity, D, DD) -> DD < D;
+should_send(D, infinity, DD) -> DD < D;
+should_send(D1, D2, DD) -> DD < lists:min([D1, D2]).