diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-09-04 17:55:11 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-09-04 17:55:11 +0100 |
commit | 491b5eccd1ee6d9e851e79d7d8991af2a21e4713 (patch) | |
tree | e97c0844f74f208dc0c8e2ebed233d7c50c9d9c7 | |
parent | bf31e4e01ff5036720bb2445f057674012300c43 (diff) | |
download | rabbitmq-server-491b5eccd1ee6d9e851e79d7d8991af2a21e4713.tar.gz |
Reify a touch more.
-rw-r--r-- | src/rabbit_mirror_queue_slave.erl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl index 3fc33f72..792adc95 100644 --- a/src/rabbit_mirror_queue_slave.erl +++ b/src/rabbit_mirror_queue_slave.erl @@ -154,11 +154,8 @@ init_it(Self, Node, QueueName) -> mnesia:read({rabbit_queue, QueueName}), case [Pid || Pid <- [QPid | MPids], node(Pid) =:= Node] of [] -> - %% Add to the end, so they are in descending order of age, see - %% rabbit_mirror_queue_misc:promote_slave/1 - MPids1 = MPids ++ [Self], rabbit_mirror_queue_misc:store_updated_slaves( - Q1#amqqueue{slave_pids = MPids1}), + Q1#amqqueue{slave_pids = add_slave(Self, MPids)}), {new, QPid}; [QPid] -> case rabbit_misc:is_process_alive(QPid) of @@ -168,13 +165,17 @@ init_it(Self, Node, QueueName) -> [SPid] -> case rabbit_misc:is_process_alive(SPid) of true -> existing; - false -> MPids1 = (MPids -- [SPid]) ++ [Self], + false -> MPids1 = add_slave(Self, MPids -- [SPid]), rabbit_mirror_queue_misc:store_updated_slaves( Q1#amqqueue{slave_pids = MPids1}), {new, QPid} end end. +%% Add to the end, so they are in descending order of age, see +%% rabbit_mirror_queue_misc:promote_slave/1 +add_slave(New, MPids) -> MPids ++ [New]. + handle_call({deliver, Delivery = #delivery { immediate = true }}, From, State) -> %% It is safe to reply 'false' here even if a) we've not seen the |