summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-12-14 15:16:43 +0000
committerSimon MacMullen <simon@rabbitmq.com>2012-12-14 15:16:43 +0000
commitb514728bcce18852d5d29659ee9b383acb133d12 (patch)
tree1d8e89bf41391a6675f5d4e684d1b7b1e17b9b27 /src
parent134fbbc3b618a628d1323eaad618c0b84862df3a (diff)
downloadrabbitmq-server-git-b514728bcce18852d5d29659ee9b383acb133d12.tar.gz
Emit an info item as soon as we start, for greater responsiveness.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mirror_queue_sync.erl14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rabbit_mirror_queue_sync.erl b/src/rabbit_mirror_queue_sync.erl
index b39f7a35dd..a9aea96682 100644
--- a/src/rabbit_mirror_queue_sync.erl
+++ b/src/rabbit_mirror_queue_sync.erl
@@ -60,24 +60,26 @@ master_prepare(Ref, Log, SPids) ->
spawn_link(fun () -> syncer(Ref, Log, MPid, SPids) end).
master_go(Syncer, Ref, Log, InfoPull, InfoPush, BQ, BQS) ->
- Args = {Syncer, Ref, Log, InfoPush, rabbit_misc:get_parent()},
+ Args = {Syncer, Ref, Log, rabbit_misc:get_parent()},
receive
{'EXIT', Syncer, normal} -> {already_synced, BQS};
{'EXIT', Syncer, Reason} -> {sync_died, Reason, BQS};
- {ready, Syncer} -> master_go0(InfoPull, Args, BQ, BQS)
+ {ready, Syncer} -> master_go0(
+ InfoPull, InfoPush, Args, BQ, BQS)
end.
-master_go0(InfoPull, Args, BQ, BQS) ->
+master_go0(InfoPull, InfoPush, Args, BQ, BQS) ->
+ InfoPush({syncing, 0}),
case BQ:fold(fun (Msg, MsgProps, {I, Last}) ->
InfoPull({syncing, I}),
- master_send(Args, I, Last, Msg, MsgProps)
+ master_send(Args, InfoPush, I, Last, Msg, MsgProps)
end, {0, erlang:now()}, BQS) of
{{shutdown, Reason}, BQS1} -> {shutdown, Reason, BQS1};
{{sync_died, Reason}, BQS1} -> {sync_died, Reason, BQS1};
{_, BQS1} -> master_done(Args, BQS1)
end.
-master_send({Syncer, Ref, Log, InfoPush, Parent}, I, Last, Msg, MsgProps) ->
+master_send({Syncer, Ref, Log, Parent}, InfoPush, I, Last, Msg, MsgProps) ->
Acc = {I + 1,
case timer:now_diff(erlang:now(), Last) > ?SYNC_PROGRESS_INTERVAL of
true -> InfoPush({syncing, I}),
@@ -106,7 +108,7 @@ master_send({Syncer, Ref, Log, InfoPush, Parent}, I, Last, Msg, MsgProps) ->
{'EXIT', Syncer, Reason} -> {stop, {sync_died, Reason}}
end.
-master_done({Syncer, Ref, _Log, _InfoPush, Parent}, BQS) ->
+master_done({Syncer, Ref, _Log, Parent}, BQS) ->
receive
{next, Ref} -> unlink(Syncer),
Syncer ! {done, Ref},