summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2017-01-02 19:48:26 +0800
committerMichael Klishin <mklishin@pivotal.io>2017-01-02 19:48:26 +0800
commitd879a863efc6effd67ac2e2e1ee2a82c330fd89f (patch)
treeddf53592712b61f285e45a69fd136bce6f9dc083 /src
parent70fdf59cb51a47592c77e06a111b4250b8d1ceb5 (diff)
downloadrabbitmq-server-git-d879a863efc6effd67ac2e2e1ee2a82c330fd89f.tar.gz
Extract a function
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_variable_queue.erl19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 94ad631f50..ae4603493c 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -432,7 +432,6 @@
%% rabbit_amqqueue_process need fairly fresh rates.
-define(MSGS_PER_RATE_CALC, 100).
-
%% we define the garbage collector threshold
%% it needs to tune the `reduce_memory_use` calls. Thus, the garbage collection.
%% see: rabbitmq-server-973 and rabbitmq-server-964
@@ -440,19 +439,21 @@
-define(EXPLICIT_GC_RUN_OP_THRESHOLD(Mode),
case get(explicit_gc_run_operation_threshold) of
undefined ->
- Val = case Mode of
- lazy -> rabbit_misc:get_env(rabbit,
- lazy_queue_explicit_gc_run_operation_threshold,
- ?DEFAULT_EXPLICIT_GC_RUN_OP_THRESHOLD);
- _ -> rabbit_misc:get_env(rabbit,
- queue_explicit_gc_run_operation_threshold,
- ?DEFAULT_EXPLICIT_GC_RUN_OP_THRESHOLD)
- end,
+ Val = explicit_gc_run_operation_threshold_for_mode(Mode),
put(explicit_gc_run_operation_threshold, Val),
Val;
Val -> Val
end).
+explicit_gc_run_operation_threshold_for_mode(Mode) ->
+ {Key, Fallback} = case Mode of
+ lazy -> {lazy_queue_explicit_gc_run_operation_threshold,
+ ?DEFAULT_EXPLICIT_GC_RUN_OP_THRESHOLD};
+ _ -> {queue_explicit_gc_run_operation_threshold,
+ ?DEFAULT_EXPLICIT_GC_RUN_OP_THRESHOLD}
+ end,
+ rabbit_misc:get_env(rabbit, Key, Fallback).
+
%%----------------------------------------------------------------------------
%% Public API
%%----------------------------------------------------------------------------