diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2012-01-31 13:17:11 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-01-31 13:17:11 +0000 |
| commit | 16236ff34e013013ad8e480df3e89caad64c629e (patch) | |
| tree | 50725b6abc8ba2fb41b1499c95a4413aee4e1357 /src | |
| parent | 2e4a51eba4a52f5ab31566458ce6d91f2f85de9d (diff) | |
| parent | cb898760b39aaf0d31a0db8ecc9368aac62daceb (diff) | |
| download | rabbitmq-server-git-16236ff34e013013ad8e480df3e89caad64c629e.tar.gz | |
merge bug24715 into default
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mirror_queue_coordinator.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/rabbit_mirror_queue_coordinator.erl b/src/rabbit_mirror_queue_coordinator.erl index 8ed2bede32..ee64b5a856 100644 --- a/src/rabbit_mirror_queue_coordinator.erl +++ b/src/rabbit_mirror_queue_coordinator.erl @@ -325,8 +325,7 @@ init([#amqqueue { name = QueueName } = Q, GM, DeathFun, LengthFun]) -> true = link(GM), GM end, - {ok, _TRef} = - timer:apply_interval(?ONE_SECOND, gm, broadcast, [GM1, heartbeat]), + ensure_gm_heartbeat(), {ok, #state { q = Q, gm = GM1, monitors = dict:new(), @@ -366,6 +365,11 @@ handle_cast({ensure_monitoring, Pids}, end, Monitors, Pids), noreply(State #state { monitors = Monitors1 }). +handle_info(send_gm_heartbeat, State = #state{gm = GM}) -> + gm:broadcast(GM, heartbeat), + ensure_gm_heartbeat(), + noreply(State); + handle_info({'DOWN', _MonitorRef, process, Pid, _Reason}, State = #state { monitors = Monitors, death_fun = DeathFun }) -> @@ -419,3 +423,6 @@ noreply(State) -> reply(Reply, State) -> {reply, Reply, State, hibernate}. + +ensure_gm_heartbeat() -> + erlang:send_after(?ONE_SECOND, self(), send_gm_heartbeat). |
