summaryrefslogtreecommitdiff
path: root/src/rabbit_event.erl
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2010-11-29 12:57:55 +0000
committerEmile Joubert <emile@rabbitmq.com>2010-11-29 12:57:55 +0000
commit30f878d2e519fbe872aef0018ba4f758ea549f11 (patch)
treeeeaa6194715dd46f9f3fb951848367f92e8bbefa /src/rabbit_event.erl
parent30e11c31fc7e0149384af3099630ce12b18db44d (diff)
downloadrabbitmq-server-30f878d2e519fbe872aef0018ba4f758ea549f11.tar.gz
Introduce some abstraction, reducing duplicate calls
Diffstat (limited to 'src/rabbit_event.erl')
-rw-r--r--src/rabbit_event.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rabbit_event.erl b/src/rabbit_event.erl
index 2b236531..c1d92f73 100644
--- a/src/rabbit_event.erl
+++ b/src/rabbit_event.erl
@@ -37,7 +37,7 @@
-export([init_stats_timer/0, ensure_stats_timer/2, stop_stats_timer/1]).
-export([reset_stats_timer/1]).
-export([stats_level/1, if_enabled/2]).
--export([notify/2]).
+-export([notify/2, notify/3]).
%%----------------------------------------------------------------------------
@@ -77,6 +77,7 @@
-spec(stats_level/1 :: (state()) -> level()).
-spec(if_enabled/2 :: (state(), timer_fun()) -> 'ok').
-spec(notify/2 :: (event_type(), event_props()) -> 'ok').
+-spec(notify/3 :: (event_type(), event_props(), boolean()) -> 'ok').
-endif.
@@ -140,6 +141,12 @@ if_enabled(_State, Fun) ->
Fun(),
ok.
+notify(Type, Props, Tx) ->
+ case Tx of
+ false -> notify(Type, Props);
+ true -> ok
+ end.
+
notify(Type, Props) ->
try
%% TODO: switch to os:timestamp() when we drop support for