summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Harrop <rharrop@vmware.com>2010-09-27 14:40:26 +0100
committerRob Harrop <rharrop@vmware.com>2010-09-27 14:40:26 +0100
commitf3f8c59c9983568ee9418eb8cbe2091bb056f3ed (patch)
treec44e2e183edfab678bba114f1bd03068b2087fcf /src
parent01567eb742fc6a13dc1b5f52f0f75e33ed3da88b (diff)
downloadrabbitmq-server-git-f3f8c59c9983568ee9418eb8cbe2091bb056f3ed.tar.gz
slight improvement to performance when discarding many messages
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue_process.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index d92dd586b0..b6578b7efb 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -459,13 +459,13 @@ fetch(AckRequired, State = #q{backing_queue_state = BQS,
State#q{backing_queue_state = BQS1}}
end.
+drop_expired_messages(State = #q{ttl = undefined}) ->
+ State;
drop_expired_messages(State = #q{backing_queue_state = BQS,
backing_queue = BQ}) ->
+ Now = timer:now_diff(now(), {0,0,0}),
BQS1 = BQ:dropwhile(
- fun (_Msg, _MsgProperties = #msg_properties{expiry = undefined}) ->
- false;
- (_Msg, _MsgProperties = #msg_properties{expiry=Expiry}) ->
- Now = timer:now_diff(os:timestamp(), {0,0,0}),
+ fun (_Msg, _MsgProperties = #msg_properties{expiry=Expiry}) ->
Now > Expiry
end, BQS),
State #q{backing_queue_state = BQS1}.