Skip to content

Commit e65e740

Browse files
author
Daniil Fedotov
committed
Drop head after changing a policy to drop-head. Clarify TODOs
1 parent 4e87def commit e65e740

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/rabbit_amqqueue_process.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,14 @@ init_max_bytes(MaxBytes, State) ->
428428
init_overflow(undefined, State) ->
429429
State;
430430
init_overflow(Overflow, State) ->
431-
%% TODO maybe drop head
432-
State#q{overflow = binary_to_existing_atom(Overflow, utf8)}.
431+
OverflowVal = binary_to_existing_atom(Overflow, utf8),
432+
case OverflowVal of
433+
'drop-head' ->
434+
{_Dropped, State1} = maybe_drop_head(State#q{overflow = OverflowVal}),
435+
State1;
436+
_ ->
437+
State#q{overflow = OverflowVal}
438+
end.
433439

434440
init_queue_mode(undefined, State) ->
435441
State;

src/rabbit_channel.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,8 @@ send_confirms_and_nacks(State = #ch{tx = none, confirmed = C, rejected = R}) ->
18791879
[MsgSeqNo | MSNs]
18801880
end, [], lists:append(C)),
18811881
State1 = send_confirms(ConfirmMsgSeqNos, State#ch{confirmed = []}),
1882-
%% TODO: msg seq nos, same as for confirms.
1882+
%% TODO: msg seq nos, same as for confirms. Need to implement
1883+
%% nack rates first.
18831884
send_nacks(lists:append(R), State1#ch{rejected = []});
18841885
pausing -> State
18851886
end;

src/rabbit_mirror_queue_slave.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ handle_cast({deliver, Delivery = #delivery{sender = Sender, flow = Flow}, true},
302302
%% We are acking messages to the channel process that sent us
303303
%% the message delivery. See
304304
%% rabbit_amqqueue_process:handle_ch_down for more info.
305-
%% TODO: reject publishes
305+
%% If message is rejected by the master, the publish will be nacked
306+
%% even if slaves confirm it. No need to check for length here.
306307
maybe_flow_ack(Sender, Flow),
307308
noreply(maybe_enqueue_message(Delivery, State));
308309

0 commit comments

Comments
 (0)