summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-09-15 20:55:40 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2012-09-15 20:55:40 +0100
commit4a0afe5bc30f15a531a98dd1a25973587a4a9bce (patch)
tree32fe4cd4f66a67dd6733cc94f9f9300cf4a68b01 /src
parent74258b338d670e0ad4f5343ccdafdd1eb8b91910 (diff)
downloadrabbitmq-server-git-4a0afe5bc30f15a531a98dd1a25973587a4a9bce.tar.gz
simplify and handle missing 'same ttl' case(!)
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue_process.erl11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index dc8ae711cb..2c3cd64d98 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -713,15 +713,10 @@ 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), 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
+ {ok, MsgTTL} = rabbit_basic:parse_expiration(Props),
+ case lists:min([TTL, MsgTTL]) of
undefined -> undefined;
- _ -> now_micros() + Milli * 1000
+ T -> now_micros() + T * 1000
end.
drop_expired_messages(State = #q{ttl = undefined}) ->