diff options
| author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-02-16 16:26:19 +0000 |
|---|---|---|
| committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-02-16 16:26:19 +0000 |
| commit | e2bec715642c14dcf92324849eb76739e1093af3 (patch) | |
| tree | d0aaf7e5d614667eccb46bfad220bf011794f213 /src | |
| parent | 45129fd39cbf15134766041e7e490e449c9047d6 (diff) | |
| download | rabbitmq-server-git-e2bec715642c14dcf92324849eb76739e1093af3.tar.gz | |
Introduced a small timeout when needs_timeout returns 'idle'.
This makes this branch as performant as default, while performing
syncs. I have to make sure that we don't rely on the timeout being
0.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_amqqueue_process.erl | 7 | ||||
| -rw-r--r-- | src/rabbit_queue_index.erl | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index b3a620fae6..01d26e6eb5 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -23,6 +23,7 @@ -define(UNSENT_MESSAGE_LIMIT, 200). -define(SYNC_INTERVAL, 25). %% milliseconds -define(RAM_DURATION_UPDATE_INTERVAL, 5000). +-define(IDLE_TIMEOUT, 10). -define(BASE_MESSAGE_PROPERTIES, #message_properties{expiry = undefined, needs_confirming = false}). @@ -250,9 +251,9 @@ next_state(State = #q{backing_queue = BQ, backing_queue_state = BQS}) -> confirm_messages(MsgIds, State#q{ backing_queue_state = BQS1}))), case BQ:needs_timeout(BQS1) of - false -> {stop_sync_timer(State1), hibernate}; - idle -> {stop_sync_timer(State1), 0 }; - timed -> {ensure_sync_timer(State1), 0 } + false -> {stop_sync_timer(State1), hibernate }; + idle -> {stop_sync_timer(State1), ?IDLE_TIMEOUT}; + timed -> {ensure_sync_timer(State1), 0 } end. backing_queue_module(#amqqueue{arguments = Args}) -> diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index 6ab2de89cd..366e1b1be1 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -285,7 +285,7 @@ ack(SeqIds, State) -> %% This is only called when there are outstanding confirms and the %% queue is idle. -sync(State = #qistate { unsynced_msg_ids = MsgIds }) -> +sync(State) -> sync_if(true, State). sync(SeqIds, State) -> |
