diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_limiter.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_mirror_queue_coordinator.erl | 11 | ||||
| -rw-r--r-- | src/rabbit_mirror_queue_slave.erl | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl index f32a187d32..82f4275a3e 100644 --- a/src/rabbit_limiter.erl +++ b/src/rabbit_limiter.erl @@ -22,7 +22,7 @@ %% %% Each channel has an associated limiter process, created with %% start_link/1, which it passes to queues on consumer creation with -%% rabbit_amqqueue:basic_consume/9, and rabbit_amqqueue:basic_get/4. +%% rabbit_amqqueue:basic_consume/10, and rabbit_amqqueue:basic_get/4. %% The latter isn't strictly necessary, since basic.get is not %% subject to limiting, but it means that whenever a queue knows about %% a channel, it also knows about its limiter, which is less fiddly. diff --git a/src/rabbit_mirror_queue_coordinator.erl b/src/rabbit_mirror_queue_coordinator.erl index a8f5e74899..38273e1c28 100644 --- a/src/rabbit_mirror_queue_coordinator.erl +++ b/src/rabbit_mirror_queue_coordinator.erl @@ -19,7 +19,7 @@ -export([start_link/4, get_gm/1, ensure_monitoring/2]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, - code_change/3]). + code_change/3, handle_pre_hibernate/1]). -export([joined/2, members_changed/3, handle_msg/3, handle_terminate/2]). @@ -390,6 +390,15 @@ terminate(_Reason, #state{}) -> code_change(_OldVsn, State, _Extra) -> {ok, State}. +handle_pre_hibernate(State = #state { gm = GM }) -> + %% Since GM notifications of deaths are lazy we might not get a + %% timely notification of slave death if policy changes when + %% everything is idle. So cause some activity just before we + %% sleep. This won't cause us to go into perpetual motion as the + %% heartbeat does not wake up coordinator or slaves. + gm:broadcast(GM, hibernate_heartbeat), + {hibernate, State}. + %% --------------------------------------------------------------------------- %% GM %% --------------------------------------------------------------------------- diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl index 45167706b4..96515f5c35 100644 --- a/src/rabbit_mirror_queue_slave.erl +++ b/src/rabbit_mirror_queue_slave.erl @@ -428,6 +428,9 @@ members_changed([ SPid], _Births, Deaths) -> {promote, CPid} -> {become, rabbit_mirror_queue_coordinator, [CPid]} end. +handle_msg([_SPid], _From, hibernate_heartbeat) -> + %% See rabbit_mirror_queue_coordinator:handle_pre_hibernate/1 + ok; handle_msg([_SPid], _From, request_depth) -> %% This is only of value to the master ok; |
