diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-09-15 20:55:40 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-09-15 20:55:40 +0100 |
commit | 709f2fdd04a9c4c84366c7ea9452f4a0073f6fd2 (patch) | |
tree | 32fe4cd4f66a67dd6733cc94f9f9300cf4a68b01 | |
parent | cd0ded1247c2b87825bb7418acdb8045d9bf004e (diff) | |
download | rabbitmq-server-709f2fdd04a9c4c84366c7ea9452f4a0073f6fd2.tar.gz |
simplify and handle missing 'same ttl' case(!)
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index dc8ae711..2c3cd64d 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}) -> |