summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-04-10 17:46:53 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-04-10 17:46:53 +0200
commit6a0ef65e490f2a2b0a1ac662bfca9489b320efa1 (patch)
treeb99dbe0f7b794e549f058cdc08160e2839ac4dc3 /src
parent5aba7d2a60f1668bde337ab2452a53ce8e597325 (diff)
parent78efd9024dc5fda41f852c585f15bf43dd3ea55b (diff)
downloadrabbitmq-server-git-6a0ef65e490f2a2b0a1ac662bfca9489b320efa1.tar.gz
Merge branch 'rabbitmq-management-33' into 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 5e9c7ceb40..8f9704c480 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.
%%----------------------------------------------------------------------------
@@ -1096,6 +1098,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