summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-09-12 17:35:46 +0100
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-09-12 17:35:46 +0100
commit7dbdc5328e52846d3473ce18543fbd8eb4c7a91d (patch)
treed32ce72d43aa0bb0a0c8b1e993c737c115c36b25 /src
parenta4a56513db8ffd999f34976cfe34dc4ca72d7c34 (diff)
downloadrabbitmq-server-git-7dbdc5328e52846d3473ce18543fbd8eb4c7a91d.tar.gz
pick the lowest between the message and queue TTL
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue_process.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 66ffb1564c..38d85f7984 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -713,9 +713,11 @@ calculate_msg_expiry(#basic_message{content = Content}, TTL) ->
#content{properties = Props} =
rabbit_binary_parser:ensure_content_decoded(Content),
%% We assert that the expiration must be valid - we check in che channel.
- Milli = case rabbit_basic:parse_expiration(Props) of
- {ok, undefined} -> TTL;
- {ok, N } -> N
+ Milli = case {rabbit_basic:parse_expiration(Props), TTL} of
+ {{ok, undefined}, _ } -> TTL;
+ {{ok, N }, undefined} -> N;
+ {{ok, N }, M } when N < M -> N;
+ {{ok, N }, M } when M < N -> M
end,
case Milli of
undefined -> undefined;