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 | a9a1448695c35d490e3f92cafb1f7299d096c13d (patch) | |
| tree | e97c0844f74f208dc0c8e2ebed233d7c50c9d9c7 /src | |
| parent | 05ca535913410d1ed7aa5e78a20e8094372847c5 (diff) | |
| download | rabbitmq-server-git-a9a1448695c35d490e3f92cafb1f7299d096c13d.tar.gz | |
Reify a touch more.
Diffstat (limited to 'src')
| -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 3fc33f7298..792adc9542 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 |
