summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-10-22 15:41:15 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-10-22 15:41:15 +0100
commiteeb7907e734f4cbbf43bc6dfcd01a1615fe48558 (patch)
treec459c1337b281db78315d06ccd2062f940f54ced
parentdc0067c5a9363501457bed061fbc3f6ff9ee1cea (diff)
downloadrabbitmq-server-bug23111.tar.gz
Rather than kicking off the ttl timer on recovery, actually drop expired msgs. Also, drop_expired_msgs when we get a stat call, which comes in from queue (re)declaration: i.e. ensure that at the point of queue (re)declaration, the counts are correctbug23111
-rw-r--r--src/rabbit_amqqueue_process.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index ee4ba675..e9b70a8f 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -162,7 +162,7 @@ init_expires(State = #q{q = #amqqueue{arguments = Arguments}}) ->
init_ttl(State = #q{q = #amqqueue{arguments = Arguments}}) ->
case rabbit_misc:table_lookup(Arguments, <<"x-message-ttl">>) of
- {_Type, TTL} -> ensure_ttl_timer(State#q{ttl = TTL});
+ {_Type, TTL} -> drop_expired_messages(State#q{ttl = TTL});
undefined -> State
end.
@@ -858,11 +858,11 @@ handle_call({basic_cancel, ChPid, ConsumerTag, OkMsg}, _From,
end
end;
-handle_call(stat, _From, State = #q{backing_queue = BQ,
- backing_queue_state = BQS,
- active_consumers = ActiveConsumers}) ->
- reply({ok, BQ:len(BQS), queue:len(ActiveConsumers)},
- ensure_expiry_timer(State));
+handle_call(stat, _From, State) ->
+ State1 = #q{backing_queue = BQ, backing_queue_state = BQS,
+ active_consumers = ActiveConsumers} =
+ drop_expired_messages(ensure_expiry_timer(State)),
+ reply({ok, BQ:len(BQS), queue:len(ActiveConsumers)}, State1);
handle_call({delete, IfUnused, IfEmpty}, _From,
State = #q{backing_queue_state = BQS, backing_queue = BQ}) ->