diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-09-11 12:05:04 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-09-11 12:05:04 +0100 |
commit | f94d97653a28fba37d506c77242f1ced6e524694 (patch) | |
tree | e5885b53378310cc1ec17fb2d9621aff7a54b1ef | |
parent | a4e745ed3e860a7208e5a4258cb97276d4b66ebe (diff) | |
download | rabbitmq-server-f94d97653a28fba37d506c77242f1ced6e524694.tar.gz |
Emit a final event to say we crashed.
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 12a3c9f0..2f2a94f4 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -234,9 +234,19 @@ terminate({shutdown, _} = R, State = #q{backing_queue = BQ}) -> terminate_shutdown(fun (BQS) -> BQ:terminate(R, BQS) end, State); terminate(normal, State) -> %% delete case terminate_shutdown(terminate_delete(true, normal, State), State); -%% If we crashed don't try to clean up the BQS, probably best to leave it. -terminate(_Reason, State) -> - terminate_shutdown(fun (BQS) -> BQS end, State). +terminate(_Reason, State = #q{q = #amqqueue{name = Name}}) -> + terminate_shutdown( + fun (BQS) -> + rabbit_event:if_enabled( + State, #q.stats_timer, + fun () -> + rabbit_event:notify(queue_stats, [{name, Name}, + {state, crashed}]) + end), + %% If we crashed don't try to clean up the BQS, probably + %% best to leave it. + BQS + end, State). terminate_delete(EmitStats, Reason, State = #q{q = #amqqueue{name = QName}, |