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 | cf3296b02e328aba7ced48edd55d50f1c652c9a2 (patch) | |
| tree | 90db4059574cb6b35f6f005ea35e20b97b5e6e16 /src | |
| parent | 11d15805af2ba40f2be56bf9d338a9da467bbbeb (diff) | |
| download | rabbitmq-server-git-cf3296b02e328aba7ced48edd55d50f1c652c9a2.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 8f52130e22..4ea7f8a103 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 596a0c5393..edc4ca8a13 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 4b862acece..dbf47965be 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) |
