diff options
author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-09-12 17:35:46 +0100 |
---|---|---|
committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-09-12 17:35:46 +0100 |
commit | de8ebece1efd57e697ffe0a444c2c98ea64331cb (patch) | |
tree | d32ce72d43aa0bb0a0c8b1e993c737c115c36b25 | |
parent | 0c4649b89582fc57c1c7cd50f4dbc7f38bea8ac0 (diff) | |
download | rabbitmq-server-de8ebece1efd57e697ffe0a444c2c98ea64331cb.tar.gz |
pick the lowest between the message and queue TTL
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 66ffb156..38d85f79 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; |