diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2010-09-21 12:59:48 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-09-21 12:59:48 +0100 |
commit | 0df493a7fda12e3b89a30df9cc4bf164474c7c70 (patch) | |
tree | ae7ab7494515bd7897243759dfb051a56d202044 | |
parent | 21b8ec03a80608cbe66911e230533cb1aff4b30b (diff) | |
parent | 33bf9857c1d1faa77109c20a95fa241d8e1cd276 (diff) | |
download | rabbitmq-server-0df493a7fda12e3b89a30df9cc4bf164474c7c70.tar.gz |
Merging heads
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 7 | ||||
-rw-r--r-- | src/rabbit_channel.erl | 8 | ||||
-rw-r--r-- | src/rabbit_event.erl | 6 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index b5adf5c1..6a59858b 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -927,7 +927,6 @@ handle_pre_hibernate(State = #q{backing_queue = BQ, DesiredDuration = rabbit_memory_monitor:report_ram_duration(self(), infinity), BQS2 = BQ:set_ram_duration_target(DesiredDuration, BQS1), - emit_stats(State), - State1 = State#q{backing_queue_state = BQS2, - stats_timer = rabbit_event:stop_stats_timer(StatsTimer)}, - {hibernate, stop_rate_timer(State1)}. + rabbit_event:if_enabled(StatsTimer, fun () -> emit_stats(State) end), + State1 = State#q{stats_timer = rabbit_event:stop_stats_timer(StatsTimer)}, + {hibernate, stop_rate_timer(State1#q{backing_queue_state = BQS2})}. diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 9b1372fa..6fbdef80 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -251,9 +251,11 @@ handle_info({'DOWN', _MRef, process, QPid, _Reason}, State) -> handle_pre_hibernate(State = #ch{stats_timer = StatsTimer}) -> ok = clear_permission_cache(), - internal_emit_stats(State), - {hibernate, - State#ch{stats_timer = rabbit_event:stop_stats_timer(StatsTimer)}}. + rabbit_event:if_enabled(StatsTimer, fun () -> + internal_emit_stats(State) + end), + State1 = State#ch{stats_timer = rabbit_event:stop_stats_timer(StatsTimer)}, + {hibernate, State1}. terminate(_Reason, State = #ch{state = terminating}) -> terminate(State); diff --git a/src/rabbit_event.erl b/src/rabbit_event.erl index ba8a3e1f..2b236531 100644 --- a/src/rabbit_event.erl +++ b/src/rabbit_event.erl @@ -90,18 +90,18 @@ start_link() -> %% On startup: %% Timer = init_stats_timer() %% notify(created event) -%% maybe(internal_emit_stats) - so we immediately send something +%% if_enabled(internal_emit_stats) - so we immediately send something %% %% On wakeup: %% ensure_stats_timer(Timer, emit_stats) %% (Note we can't emit stats immediately, the timer may have fired 1ms ago.) %% %% emit_stats: -%% internal_emit_stats +%% if_enabled(internal_emit_stats) %% reset_stats_timer(Timer) - just bookkeeping %% %% Pre-hibernation: -%% internal_emit_stats +%% if_enabled(internal_emit_stats) %% stop_stats_timer(Timer) %% %% internal_emit_stats: |