diff options
author | Emile Joubert <emile@rabbitmq.com> | 2013-06-11 13:56:54 +0100 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2013-06-11 13:56:54 +0100 |
commit | 23637ac030e38d705ef00c2687e5e316b89913cc (patch) | |
tree | 0ed4ea6a21ebe551f1fb7e8f2dab5ad057206074 | |
parent | eea4bbf3276853d524a1a93e32b4fb90a45067a8 (diff) | |
download | rabbitmq-server-23637ac030e38d705ef00c2687e5e316b89913cc.tar.gz |
Omit emitting stats for non-existent queues on termination
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index a7a227e1..45a45dba 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -153,6 +153,8 @@ init_state(Q) -> terminate(shutdown = R, State = #q{backing_queue = BQ}) -> terminate_shutdown(fun (BQS) -> BQ:terminate(R, BQS) end, State); +terminate({shutdown, missing_owner}, State) -> + terminate(missing_owner, State); terminate({shutdown, _} = R, State = #q{backing_queue = BQ}) -> terminate_shutdown(fun (BQS) -> BQ:terminate(R, BQS) end, State); terminate(Reason, State = #q{q = #amqqueue{name = QName}, @@ -161,8 +163,11 @@ terminate(Reason, State = #q{q = #amqqueue{name = QName}, fun (BQS) -> BQS1 = BQ:delete_and_terminate(Reason, BQS), %% don't care if the internal delete doesn't return 'ok'. - rabbit_event:if_enabled(State, #q.stats_timer, - fun() -> emit_stats(State) end), + if Reason =/= missing_owner -> + rabbit_event:if_enabled(State, #q.stats_timer, + fun() -> emit_stats(State) end); + true -> ok + end, rabbit_amqqueue:internal_delete(QName), BQS1 end, State). @@ -1059,8 +1064,8 @@ handle_call({init, Recover}, From, BQ = backing_queue_module(Q), BQS = bq_init(BQ, Q, Recover), %% Rely on terminate to delete the queue. - {stop, normal, State#q{backing_queue = BQ, - backing_queue_state = BQS}} + {stop, {shutdown, missing_owner}, + State#q{backing_queue = BQ, backing_queue_state = BQS}} end; handle_call(info, _From, State) -> |