diff options
| -rw-r--r-- | src/rabbit_amqqueue_process.erl | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 9494367764..f2a48ae27d 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -1341,6 +1341,22 @@ handle_cast(force_event_refresh, State = #q{exclusive_consumer = Exclusive}) -> handle_cast({dead_letter, {Msg, AckTag}, Reason}, State) -> dead_letter_msg(Msg, AckTag, Reason, State). +handle_info({'DOWN', _MonitorRef, process, DownPid, _Reason}, + State = #q{q = #amqqueue{exclusive_owner = DownPid}}) -> + %% Exclusively owned queues must disappear with their owner. In + %% the case of clean shutdown we delete the queue synchronously in + %% the reader - although not required by the spec this seems to + %% match what people expect (see bug 21824). However we need this + %% monitor-and-async- delete in case the connection goes away + %% unexpectedly. + stop_later(normal, State); + +handle_info({'DOWN', _MonitorRef, process, DownPid, Reason}, State) -> + case handle_ch_down(DownPid, State) of + {ok, State1} -> handle_queue_down(DownPid, Reason, State1); + {stop, State1} -> stop_later(normal, State1) + end; + handle_info(_, State = #q{delayed_stop = DS}) when DS =/= undefined -> noreply(State); @@ -1360,21 +1376,6 @@ handle_info(emit_stats, State) -> assert_invariant(State1), {noreply, State1, hibernate}; -handle_info({'DOWN', _MonitorRef, process, DownPid, _Reason}, - State = #q{q = #amqqueue{exclusive_owner = DownPid}}) -> - %% Exclusively owned queues must disappear with their owner. In - %% the case of clean shutdown we delete the queue synchronously in - %% the reader - although not required by the spec this seems to - %% match what people expect (see bug 21824). However we need this - %% monitor-and-async- delete in case the connection goes away - %% unexpectedly. - stop_later(normal, State); -handle_info({'DOWN', _MonitorRef, process, DownPid, Reason}, State) -> - case handle_ch_down(DownPid, State) of - {ok, State1} -> handle_queue_down(DownPid, Reason, State1); - {stop, State1} -> stop_later(normal, State1) - end; - handle_info(update_ram_duration, State = #q{backing_queue = BQ, backing_queue_state = BQS}) -> {RamDuration, BQS1} = BQ:ram_duration(BQS), |
