diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2010-10-22 15:41:15 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-10-22 15:41:15 +0100 |
commit | eeb7907e734f4cbbf43bc6dfcd01a1615fe48558 (patch) | |
tree | c459c1337b281db78315d06ccd2062f940f54ced | |
parent | dc0067c5a9363501457bed061fbc3f6ff9ee1cea (diff) | |
download | rabbitmq-server-eeb7907e734f4cbbf43bc6dfcd01a1615fe48558.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.erl | 12 |
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}) -> |