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 | 2964916c9699ce2dde24b4fa42325d0817e4ef6e (patch) | |
| tree | 80676036a1f64719ced0f287188d4a3ae59d1ba5 /src | |
| parent | 9bac300b60ed73c9f48a4f40dde5bc2761c24adb (diff) | |
| parent | 7ba4b784cc6a1c9fd38eddbb3d5a7086eb20b288 (diff) | |
| download | rabbitmq-server-git-2964916c9699ce2dde24b4fa42325d0817e4ef6e.tar.gz | |
merge stable into default
Diffstat (limited to 'src')
| -rw-r--r-- | src/gm.erl | 10 | ||||
| -rw-r--r-- | src/rabbit_vm.erl | 10 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/gm.erl b/src/gm.erl index 4a95de0dd1..2057b1f577 100644 --- a/src/gm.erl +++ b/src/gm.erl @@ -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 53f3df18b3..e96792762c 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; |
