@@ -526,24 +526,24 @@ handle_method(#'basic.recover'{requeue = false},
526526 _ , State = # ch { transaction_id = none ,
527527 writer_pid = WriterPid ,
528528 unacked_message_q = UAMQ }) ->
529- lists : foreach (
530- fun ({_DeliveryTag , none , _Msg }) ->
531- % % Was sent as a basic.get_ok. Don't redeliver
532- % % it. FIXME: appropriate?
533- ok ;
534- ({DeliveryTag , ConsumerTag ,
535- {QName , QPid , MsgId , _Redelivered , Message }}) ->
536- % % Was sent as a proper consumer delivery. Resend it as
537- % % before.
538- % %
539- % % FIXME: What should happen if the consumer's been
540- % % cancelled since?
541- % %
542- % % FIXME: should we allocate a fresh DeliveryTag?
543- ok = internal_deliver (
529+ ok = rabbit_misc : queue_fold (
530+ fun ({_DeliveryTag , none , _Msg }, ok ) ->
531+ % % Was sent as a basic.get_ok. Don't redeliver
532+ % % it. FIXME: appropriate?
533+ ok ;
534+ ({DeliveryTag , ConsumerTag ,
535+ {QName , QPid , MsgId , _Redelivered , Message }}, ok ) ->
536+ % % Was sent as a proper consumer delivery. Resend
537+ % % it as before.
538+ % %
539+ % % FIXME: What should happen if the consumer's been
540+ % % cancelled since?
541+ % %
542+ % % FIXME: should we allocate a fresh DeliveryTag?
543+ internal_deliver (
544544 WriterPid , false , ConsumerTag , DeliveryTag ,
545545 {QName , QPid , MsgId , true , Message })
546- end , queue : to_list ( UAMQ ) ),
546+ end , ok , UAMQ ),
547547 % % No answer required, apparently!
548548 {noreply , State };
549549
@@ -872,7 +872,7 @@ rollback_and_notify(State) ->
872872 notify_queues (internal_rollback (State )).
873873
874874fold_per_queue (F , Acc0 , UAQ ) ->
875- D = lists : foldl (
875+ D = rabbit_misc : queue_fold (
876876 fun ({_DTag , _CTag ,
877877 {_QName , QPid , MsgId , _Redelivered , _Message }}, D ) ->
878878 % % dict:append would be simpler and avoid the
@@ -883,7 +883,7 @@ fold_per_queue(F, Acc0, UAQ) ->
883883 fun (MsgIds ) -> [MsgId | MsgIds ] end ,
884884 [MsgId ],
885885 D )
886- end , dict :new (), queue : to_list ( UAQ ) ),
886+ end , dict :new (), UAQ ),
887887 dict :fold (fun (QPid , MsgIds , Acc ) -> F (QPid , MsgIds , Acc ) end ,
888888 Acc0 , D ).
889889
@@ -912,9 +912,9 @@ consumer_queues(Consumers) ->
912912notify_limiter (undefined , _Acked ) ->
913913 ok ;
914914notify_limiter (LimiterPid , Acked ) ->
915- case lists : foldl (fun ({_ , none , _ }, Acc ) -> Acc ;
916- ({_ , _ , _ }, Acc ) -> Acc + 1
917- end , 0 , queue : to_list ( Acked ) ) of
915+ case rabbit_misc : queue_fold (fun ({_ , none , _ }, Acc ) -> Acc ;
916+ ({_ , _ , _ }, Acc ) -> Acc + 1
917+ end , 0 , Acked ) of
918918 0 -> ok ;
919919 Count -> rabbit_limiter :ack (LimiterPid , Count )
920920 end .
0 commit comments