summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-04-10 17:47:33 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-04-10 17:47:33 +0200
commit58749727df061836f7808b934a549fe4b00b670b (patch)
treeea74e3dd6361e5cf524ea58816e79fb51d63e7f8 /src
parent588b64e2262b3566cde101474d72a91f1cb80305 (diff)
parent6a0ef65e490f2a2b0a1ac662bfca9489b320efa1 (diff)
downloadrabbitmq-server-git-58749727df061836f7808b934a549fe4b00b670b.tar.gz
Merge branch 'stable'
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_misc.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 72edc355a4..ad94ce689c 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -72,6 +72,7 @@
-export([store_proc_name/1, store_proc_name/2]).
-export([moving_average/4]).
-export([now_to_ms/1]).
+-export([get_env/3]).
%% Horrible macro to use in guards
-define(IS_BENIGN_EXIT(R),
@@ -261,6 +262,7 @@
-spec(now_to_ms/1 :: ({non_neg_integer(),
non_neg_integer(),
non_neg_integer()}) -> pos_integer()).
+-spec(get_env/3 :: (atom(), atom(), term()) -> term()).
-endif.
%%----------------------------------------------------------------------------
@@ -1097,6 +1099,13 @@ cancel_timer({timer, Ref}) -> {ok, cancel} = timer:cancel(Ref),
store_proc_name(Type, ProcName) -> store_proc_name({Type, ProcName}).
store_proc_name(TypeProcName) -> put(process_name, TypeProcName).
+%% application:get_env/3 is only available in R16B01 or later.
+get_env(Application, Key, Def) ->
+ case application:get_env(Application, Key) of
+ {ok, Val} -> Val;
+ undefined -> Def
+ end.
+
moving_average(_Time, _HalfLife, Next, undefined) ->
Next;
%% We want the Weight to decrease as Time goes up (since Weight is the