summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-12-05 12:31:30 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-12-05 12:31:30 +0000
commite8ab5e25305448a741f76f8abdf32eede6ff8542 (patch)
treeb5cc57d363e61c30e49d3557da1e15cbff6464d2
parent5c30e7cf1fd1502ed5b30da8a6617705f27cd34f (diff)
parent7cebcb282e0427c526063a78f09bce777fdd4c6a (diff)
downloadrabbitmq-server-e8ab5e25305448a741f76f8abdf32eede6ff8542.tar.gz
merge bug25340 into stable
-rw-r--r--src/gm.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gm.erl b/src/gm.erl
index 4a95de0d..2057b1f5 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 }) ->