diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mirror_queue_sync.erl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/rabbit_mirror_queue_sync.erl b/src/rabbit_mirror_queue_sync.erl index 3ef4e9d9ac..3e55a39178 100644 --- a/src/rabbit_mirror_queue_sync.erl +++ b/src/rabbit_mirror_queue_sync.erl @@ -245,17 +245,11 @@ syncer_loop(Ref, MPid, SPids) -> receive {msg, Ref, Msg, MsgProps, Unacked} -> SPids1 = wait_for_credit(SPids), - [begin - credit_flow:send(SPid), - SPid ! {sync_msg, Ref, Msg, MsgProps, Unacked} - end || SPid <- SPids1], + broadcast(SPids1, {sync_msg, Ref, Msg, MsgProps, Unacked}), syncer_loop(Ref, MPid, SPids1); {msgs, Ref, Msgs} -> SPids1 = wait_for_credit(SPids), - [begin - credit_flow:send(SPid), - SPid ! {sync_msgs, Ref, Msgs} - end || SPid <- SPids1], + broadcast(SPids1, {sync_msgs, Ref, Msgs}), syncer_loop(Ref, MPid, SPids1); {cancel, Ref} -> %% We don't tell the slaves we will die - so when we do @@ -266,6 +260,12 @@ syncer_loop(Ref, MPid, SPids) -> [SPid ! {sync_complete, Ref} || SPid <- SPids] end. +broadcast(SPids, Msg) -> + [begin + credit_flow:send(SPid), + SPid ! Msg + end || SPid <- SPids], + wait_for_credit(SPids) -> case credit_flow:blocked() of true -> receive |
