dovecot-2.2: imapc: Don't flush prefetch FETCH command before it...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Mar 11 14:40:57 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/f8f57dde247d
changeset: 18323:f8f57dde247d
user: Timo Sirainen <tss at iki.fi>
date: Wed Mar 11 14:39:52 2015 +0200
description:
imapc: Don't flush prefetch FETCH command before it has mail_prefetch_count number of mails.
diffstat:
src/lib-storage/index/imapc/imapc-mail-fetch.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r d21f71ab9f28 -r f8f57dde247d src/lib-storage/index/imapc/imapc-mail-fetch.c
--- a/src/lib-storage/index/imapc/imapc-mail-fetch.c Wed Mar 11 14:39:26 2015 +0200
+++ b/src/lib-storage/index/imapc/imapc-mail-fetch.c Wed Mar 11 14:39:52 2015 +0200
@@ -146,7 +146,19 @@
}
array_append(&mbox->pending_fetch_request->mails, &mail, 1);
- if (mbox->to_pending_fetch_send == NULL) {
+ if (mbox->to_pending_fetch_send == NULL &&
+ array_count(&mbox->pending_fetch_request->mails) >
+ mbox->box.storage->set->mail_prefetch_count) {
+ /* we're now prefetching the maximum number of mails. this
+ most likely means that we need to flush out the command now
+ before sending anything else. delay it a little bit though
+ in case the sending code doesn't actually use
+ mail_prefetch_count and wants to fetch more.
+
+ note that we don't want to add this timeout too early,
+ because we want to optimize the maximum number of messages
+ placed into a single FETCH. even without timeout the command
+ gets flushed by imapc_mail_fetch() call. */
mbox->to_pending_fetch_send =
timeout_add_short(0, imapc_mail_fetch_flush, mbox);
}
@@ -397,7 +409,8 @@
imapc_command_send(cmd, str_c(mbox->pending_fetch_cmd));
mbox->pending_fetch_request = NULL;
- timeout_remove(&mbox->to_pending_fetch_send);
+ if (mbox->to_pending_fetch_send != NULL)
+ timeout_remove(&mbox->to_pending_fetch_send);
str_truncate(mbox->pending_fetch_cmd, 0);
}
More information about the dovecot-cvs
mailing list