diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2010-10-05 15:35:51 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-10-05 15:35:51 +0100 |
commit | a5e48b84c9f507f534c69eb8fabacafea9de0360 (patch) | |
tree | d2a24537ecf298bd6db8bef083a66125fa647769 | |
parent | b11e17b0f19a5d63f968d577a101d58af9ea103e (diff) | |
download | rabbitmq-server-bug23156.tar.gz |
Refresh expiry on stat call as used by queue redeclarationbug23156
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 2c53a8e3..61204deb 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -251,8 +251,9 @@ stop_expiry_timer(State = #q{expiry_timer_ref = TRef}) -> {ok, cancel} = timer:cancel(TRef), State#q{expiry_timer_ref = undefined}. -%% We only wish to expire where there are no consumers *and* when -%% basic.get hasn't been called for the configured period. +%% We wish to expire only when there are no consumers *and* the expiry +%% hasn't been refreshed (by queue.declare or basic.get) for the +%% configured period. ensure_expiry_timer(State = #q{expires = undefined}) -> State; ensure_expiry_timer(State = #q{expires = Expires}) -> @@ -783,7 +784,8 @@ handle_call({basic_cancel, ChPid, ConsumerTag, OkMsg}, _From, handle_call(stat, _From, State = #q{backing_queue = BQ, backing_queue_state = BQS, active_consumers = ActiveConsumers}) -> - reply({ok, BQ:len(BQS), queue:len(ActiveConsumers)}, State); + reply({ok, BQ:len(BQS), queue:len(ActiveConsumers)}, + ensure_expiry_timer(State)); handle_call(delete_exclusive, _From, State = #q{ backing_queue_state = BQS, |