summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2012-12-17 11:52:57 +0000
committerEmile Joubert <emile@rabbitmq.com>2012-12-17 11:52:57 +0000
commit19e6ab32a1b4da7c16dc10161b11f513c1383436 (patch)
treecaf1f2362affbd0ff45c8ceceb6a5a9d4a4ac91e
parent5fc15bf23c0911a9fed976620264a42afd61cd9b (diff)
downloadrabbitmq-server-19e6ab32a1b4da7c16dc10161b11f513c1383436.tar.gz
Ensure TTL conditionally
-rw-r--r--src/rabbit_amqqueue_process.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 90e58f25..ffff464d 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -579,9 +579,13 @@ deliver_or_enqueue(Delivery = #delivery{message = Message},
{false, State2 = #q{ttl = 0, dlx = undefined}} ->
discard(Delivery, State2);
{false, State2} ->
- BQS1 = publish_max(Delivery, Props, Delivered, State2),
- ensure_ttl_timer(Props#message_properties.expiry,
- State2#q{backing_queue_state = BQS1})
+ case publish_max(Delivery, Props, Delivered, State2) of
+ nopub ->
+ State2;
+ BQS1 ->
+ ensure_ttl_timer(Props#message_properties.expiry,
+ State2#q{backing_queue_state = BQS1})
+ end
end.
publish_max(#delivery{message = Message,
@@ -612,7 +616,7 @@ publish_max(#delivery{message = Message,
true -> rabbit_misc:confirm_to_sender(SenderPid, [MsgSeqNo]);
false -> ok
end,
- BQS;
+ nopub;
{true, false} ->
{{Msg, _IsDelivered, AckTag}, BQS1} = BQ:fetch(true, BQS),
(dead_letter_fun(maxdepth))([{Msg, AckTag}]),