diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2012-04-19 16:20:12 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2012-04-19 16:20:12 +0100 |
commit | 06f918c2b250299a4fe21dffb2a7cae0ede4a4a3 (patch) | |
tree | abeb55afeb8fc6aa8c349657c1774d1bad048873 | |
parent | 7dc0a3e863acb9f01319de9dddaf7b9d6499523e (diff) | |
parent | a656a34b97f863389cd4ba9acc5a39fdb0ef34dc (diff) | |
download | rabbitmq-server-06f918c2b250299a4fe21dffb2a7cae0ede4a4a3.tar.gz |
Merge bug24863 to default
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 2063e557..064df26f 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -717,6 +717,14 @@ ensure_ttl_timer(State = #q{backing_queue = BQ, ensure_ttl_timer(State) -> State. +ack_if_no_dlx(AckTags, State = #q{dlx = undefined, + backing_queue = BQ, + backing_queue_state = BQS }) -> + {_Guids, BQS1} = BQ:ack(AckTags, BQS), + State#q{backing_queue_state = BQS1}; +ack_if_no_dlx(_AckTags, State) -> + State. + dead_letter_fun(_Reason, #q{dlx = undefined}) -> undefined; dead_letter_fun(Reason, _State) -> @@ -1233,13 +1241,16 @@ handle_cast({reject, AckTags, Requeue, ChPid}, State) -> noreply(subtract_acks( ChPid, AckTags, State, case Requeue of - true -> fun (State1) -> requeue_and_run(AckTags, State1) end; - false -> Fun = dead_letter_fun(rejected, State), - fun (State1 = #q{backing_queue = BQ, - backing_queue_state = BQS}) -> - BQS1 = BQ:fold(Fun, BQS, AckTags), - State1#q{backing_queue_state = BQS1} - end + true -> + fun (State1) -> requeue_and_run(AckTags, State1) end; + false -> + fun (State1 = #q{backing_queue = BQ, + backing_queue_state = BQS}) -> + Fun = dead_letter_fun(rejected, State1), + BQS1 = BQ:fold(Fun, BQS, AckTags), + ack_if_no_dlx( + AckTags, State1#q{backing_queue_state = BQS1}) + end end)); handle_cast(delete_immediately, State) -> |