diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2010-09-14 15:04:57 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2010-09-14 15:04:57 +0100 |
commit | 864d170e361d3f0f128e57e97d422213f0b5454c (patch) | |
tree | 90db4059574cb6b35f6f005ea35e20b97b5e6e16 /src | |
parent | 5a7cc3caaa82c48d5a7b97e0776045f488a9a1d5 (diff) | |
download | rabbitmq-server-864d170e361d3f0f128e57e97d422213f0b5454c.tar.gz |
Don't forget about stats timer before hibernating; it may fire after hibernating.
Diffstat (limited to 'src')
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 10 | ||||
-rw-r--r-- | src/rabbit_channel.erl | 8 | ||||
-rw-r--r-- | src/rabbit_event.erl | 1 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 8f52130e..4ea7f8a1 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -582,9 +582,8 @@ i(backing_queue_status, #q{backing_queue_state = BQS, backing_queue = BQ}) -> i(Item, _) -> throw({bad_argument, Item}). -emit_stats(State = #q{stats_timer = StatsTimer}) -> - rabbit_event:notify(queue_stats, infos(?STATISTICS_KEYS, State)), - State#q{stats_timer = rabbit_event:reset_stats_timer(StatsTimer)}. +emit_stats(State) -> + rabbit_event:notify(queue_stats, infos(?STATISTICS_KEYS, State)). %--------------------------------------------------------------------------- @@ -885,9 +884,10 @@ handle_cast(maybe_expire, State) -> false -> noreply(ensure_expiry_timer(State)) end; -handle_cast(emit_stats, State) -> +handle_cast(emit_stats, State = #q{stats_timer = StatsTimer}) -> %% Do not invoke noreply as it would see no timer and create a new one. - State1 = emit_stats(State), + emit_stats(State), + State1 = State#q{stats_timer = rabbit_event:reset_stats_timer(StatsTimer)}, {noreply, State1}. handle_info({'DOWN', _MonitorRef, process, DownPid, _Reason}, diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 596a0c53..edc4ca8a 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -240,8 +240,9 @@ handle_cast({deliver, ConsumerTag, AckRequired, Msg}, end, State), noreply(State1#ch{next_tag = DeliveryTag + 1}); -handle_cast(emit_stats, State) -> - State1 = internal_emit_stats(State), +handle_cast(emit_stats, State = #ch{stats_timer = StatsTimer}) -> + internal_emit_stats(State), + State1 = State#ch{stats_timer = rabbit_event:reset_stats_timer(StatsTimer)}, {noreply, State1}. handle_info({'DOWN', _MRef, process, QPid, _Reason}, State) -> @@ -1160,8 +1161,7 @@ internal_emit_stats(State = #ch{stats_timer = StatsTimer}) -> [{QX, Stats} || {{queue_exchange_stats, QX}, Stats} <- get()]}], rabbit_event:notify(channel_stats, CoarseStats ++ FineStats) - end, - State#ch{stats_timer = rabbit_event:reset_stats_timer(StatsTimer)}. + end. erase_queue_stats(QPid) -> erase({monitoring, QPid}), diff --git a/src/rabbit_event.erl b/src/rabbit_event.erl index 4b862ace..dbf47965 100644 --- a/src/rabbit_event.erl +++ b/src/rabbit_event.erl @@ -101,7 +101,6 @@ start_link() -> %% %% Pre-hibernation: %% internal_emit_stats -%% reset_stats_timer(Timer) - just bookkeeping %% %% internal_emit_stats: %% notify(stats) |