summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;