diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-12-05 12:33:45 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-12-05 12:33:45 +0000 |
commit | a38e4cfeb5e1657210c8badcccef54d55f48f22b (patch) | |
tree | 80676036a1f64719ced0f287188d4a3ae59d1ba5 | |
parent | db9999bd68df6cbd541b5c43167b13db47b9f2fd (diff) | |
parent | bf385228d8cd6260590e8696c98d0ce6540265fc (diff) | |
download | rabbitmq-server-a38e4cfeb5e1657210c8badcccef54d55f48f22b.tar.gz |
merge stable into default
-rw-r--r-- | src/gm.erl | 10 | ||||
-rw-r--r-- | src/rabbit_vm.erl | 10 |
2 files changed, 17 insertions, 3 deletions
@@ -667,6 +667,9 @@ handle_info(flush, State) -> noreply( flush_broadcast_buffer(State #state { broadcast_timer = undefined })); +handle_info(timeout, State) -> + noreply(flush_broadcast_buffer(State)); + handle_info({'DOWN', MRef, process, _Pid, Reason}, State = #state { self = Self, left = Left, @@ -834,10 +837,13 @@ handle_msg({activity, _NotLeft, _Activity}, State) -> noreply(State) -> - {noreply, ensure_broadcast_timer(State), hibernate}. + {noreply, ensure_broadcast_timer(State), flush_timeout(State)}. reply(Reply, State) -> - {reply, Reply, ensure_broadcast_timer(State), hibernate}. + {reply, Reply, ensure_broadcast_timer(State), flush_timeout(State)}. + +flush_timeout(#state{broadcast_buffer = []}) -> hibernate; +flush_timeout(_) -> 0. ensure_broadcast_timer(State = #state { broadcast_buffer = [], broadcast_timer = undefined }) -> diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl index 53f3df18..e9679276 100644 --- a/src/rabbit_vm.erl +++ b/src/rabbit_vm.erl @@ -84,7 +84,15 @@ sup_memory(Sup) -> sup_children(Sup) -> rabbit_misc:with_exit_handler( - rabbit_misc:const([]), fun () -> supervisor:which_children(Sup) end). + rabbit_misc:const([]), + fun () -> + %% Just in case we end up talking to something that is + %% not a supervisor by mistake. + case supervisor:which_children(Sup) of + L when is_list(L) -> L; + _ -> [] + end + end). pid_memory(Pid) when is_pid(Pid) -> case process_info(Pid, memory) of {memory, M} -> M; |