summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Watson <tim@rabbitmq.com>2012-10-31 16:17:52 +0000
committerTim Watson <tim@rabbitmq.com>2012-10-31 16:17:52 +0000
commit7ba0593d45d53027cd0e6e74c93f43e3d894dd85 (patch)
treef2aafb49d2aad013b95387bf1b690ad8980509bc /src
parentc791885aaa816f35a2c77079cd96486a84aaf181 (diff)
downloadrabbitmq-server-git-7ba0593d45d53027cd0e6e74c93f43e3d894dd85.tar.gz
if per-queue ttl is enabled, don't skip dropping expired messages
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue_process.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 2cf3e9f125..b52d221358 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -719,6 +719,9 @@ calculate_msg_expiry(#basic_message{content = Content}, TTL) ->
T -> now_micros() + T * 1000
end.
+drop_expired_messages(State = #q{ttl = undefined,
+ ttl_timer_ref = undefined}) ->
+ State;
drop_expired_messages(State = #q{backing_queue_state = BQS,
backing_queue = BQ }) ->
Now = now_micros(),
@@ -737,7 +740,8 @@ drop_expired_messages(State = #q{backing_queue_state = BQS,
ensure_ttl_timer(case Props of
undefined -> undefined;
#message_properties{expiry = Exp} -> Exp
- end, State#q{backing_queue_state = BQS1}).
+ end, State#q{backing_queue_state = BQS1,
+ ttl_timer_ref = undefined}).
ensure_ttl_timer(undefined, State) ->
State;
@@ -1321,7 +1325,7 @@ handle_info(maybe_expire, State) ->
end;
handle_info(drop_expired, State) ->
- noreply(drop_expired_messages(State#q{ttl_timer_ref = undefined}));
+ noreply(drop_expired_messages(State));
handle_info(emit_stats, State) ->
%% Do not invoke noreply as it would see no timer and create a new one.