diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2010-08-03 19:40:14 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-08-03 19:40:14 +0100 |
commit | bee5756de287f155a78c29922a693d331a1cb466 (patch) | |
tree | 2ddcb38998cb561824808b0c54f249589ed77bcf | |
parent | 97e24e2854c18dadcc9c48955cead1d01c734622 (diff) | |
download | rabbitmq-server-bug23059.tar.gz |
make queue collector shutdown asynchronousbug23059
and add a spec for it
-rw-r--r-- | src/rabbit_queue_collector.erl | 12 | ||||
-rw-r--r-- | src/rabbit_reader.erl | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/rabbit_queue_collector.erl b/src/rabbit_queue_collector.erl index ea3768d4..9257ec82 100644 --- a/src/rabbit_queue_collector.erl +++ b/src/rabbit_queue_collector.erl @@ -49,6 +49,7 @@ -spec(start_link/0 :: () -> rabbit_types:ok(pid())). -spec(register/2 :: (pid(), rabbit_types:amqqueue()) -> 'ok'). -spec(delete_all/1 :: (pid()) -> 'ok'). +-spec(shutdown/1 :: (pid()) -> 'ok'). -endif. @@ -64,7 +65,7 @@ delete_all(CollectorPid) -> gen_server:call(CollectorPid, delete_all, infinity). shutdown(CollectorPid) -> - gen_server:call(CollectorPid, shutdown, infinity). + gen_server:cast(CollectorPid, shutdown). %%---------------------------------------------------------------------------- @@ -87,13 +88,10 @@ handle_call(delete_all, _From, State = #state{queues = Queues}) -> rabbit_amqqueue:delete(Q, false, false) end) || {MonitorRef, Q} <- dict:to_list(Queues)], - {reply, ok, State}; + {reply, ok, State}. -handle_call(shutdown, _From, State) -> - {stop, normal, ok, State}. - -handle_cast(_Msg, State) -> - {noreply, State}. +handle_cast(shutdown, State) -> + {stop, normal, State}. handle_info({'DOWN', MonitorRef, process, _DownPid, _Reason}, State = #state{queues = Queues}) -> diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 17443926..532572fd 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -285,8 +285,8 @@ start_connection(Parent, Deb, Sock, SockTransform) -> %% %% gen_tcp:close(ClientSock), teardown_profiling(ProfilingValue), - rabbit_queue_collector:shutdown(Collector), rabbit_misc:unlink_and_capture_exit(Collector), + rabbit_queue_collector:shutdown(Collector), rabbit_event:notify(connection_closed, [{pid, self()}]) end, done. |