@@ -299,9 +299,9 @@ settlement_action(Type, QRef, MsgSeqs, Acc) ->
299
299
deliver (Qs0 , # delivery {flow = Flow ,
300
300
msg_seq_no = MsgNo ,
301
301
message = # basic_message {exchange_name = _Ex },
302
- confirm = _Confirm } = Delivery ) ->
302
+ confirm = Confirm } = Delivery ) ->
303
303
% % TODO: record master and slaves for confirm processing
304
- {MPids , SPids , Qs , Actions } = qpids (Qs0 , MsgNo ),
304
+ {MPids , SPids , Qs , Actions } = qpids (Qs0 , Confirm , MsgNo ),
305
305
QPids = MPids ++ SPids ,
306
306
case Flow of
307
307
% % Here we are tracking messages sent by the rabbit_channel
@@ -361,22 +361,22 @@ purge(Q) when ?is_amqqueue(Q) ->
361
361
QPid = amqqueue :get_pid (Q ),
362
362
delegate :invoke (QPid , {gen_server2 , call , [purge , infinity ]}).
363
363
364
- qpids (Qs , MsgNo ) ->
364
+ qpids (Qs , Confirm , MsgNo ) ->
365
365
lists :foldl (
366
366
fun ({Q , S0 }, {MPidAcc , SPidAcc , Qs0 , Actions0 }) ->
367
367
QPid = amqqueue :get_pid (Q ),
368
368
SPids = amqqueue :get_slave_pids (Q ),
369
369
QRef = amqqueue :get_name (Q ),
370
370
Actions = [{monitor , QPid , QRef }
371
371
| [{monitor , P , QRef } || P <- SPids ]] ++ Actions0 ,
372
- % % confirm record only if MsgNo isn't undefined
372
+ % % confirm record only if necessary
373
373
S = case S0 of
374
374
#? STATE {unconfirmed = U0 } ->
375
375
Rec = [QPid | SPids ],
376
- U = case MsgNo of
377
- undefined ->
376
+ U = case Confirm of
377
+ false ->
378
378
U0 ;
379
- _ ->
379
+ true ->
380
380
U0 #{MsgNo => # msg_status {pending = Rec }}
381
381
end ,
382
382
S0 #? STATE {pid = QPid ,
0 commit comments