summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2013-06-27 14:02:17 +0100
committerEmile Joubert <emile@rabbitmq.com>2013-06-27 14:02:17 +0100
commit23344f846db43fcedd526f3ce0127fbf4847396e (patch)
tree6fafaa9e31691485e018a554e70714f4f8973f4d
parenta222f45cb5c56ed51a2f40fa00f99cc5b3b49e90 (diff)
downloadrabbitmq-server-23344f846db43fcedd526f3ce0127fbf4847396e.tar.gz
Stem leak when master deals with discarded messages
-rw-r--r--src/rabbit_mirror_queue_master.erl20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/rabbit_mirror_queue_master.erl b/src/rabbit_mirror_queue_master.erl
index bcd4861a..acf77df6 100644
--- a/src/rabbit_mirror_queue_master.erl
+++ b/src/rabbit_mirror_queue_master.erl
@@ -229,17 +229,15 @@ discard(MsgId, ChPid, State = #state { gm = GM,
%% already been published or published-and-confirmed. To do that
%% would require non FIFO access. Hence we should not find
%% 'published' or 'confirmed' in this dict:find.
- case dict:find(MsgId, SS) of
- error ->
- ok = gm:broadcast(GM, {discard, ChPid, MsgId}),
- BQS1 = BQ:discard(MsgId, ChPid, BQS),
- ensure_monitoring(
- ChPid, State #state {
- backing_queue_state = BQS1,
- seen_status = dict:erase(MsgId, SS) });
- {ok, discarded} ->
- State
- end.
+ State1 = case dict:find(MsgId, SS) of
+ error ->
+ ok = gm:broadcast(GM, {discard, ChPid, MsgId}),
+ State #state { backing_queue_state =
+ BQ:discard(MsgId, ChPid, BQS) };
+ {ok, discarded} ->
+ State #state { seen_status = dict:erase(MsgId, SS) }
+ end,
+ ensure_monitoring(ChPid, State1).
dropwhile(Pred, State = #state{backing_queue = BQ,
backing_queue_state = BQS }) ->