Mercurial > dovecot > core-2.2
changeset 13208:e6eaf803ce09
doveadm index -n: Don't sync mailbox when checking the recent count.
The syncing alone can take a long time with huge maildirs. Better to be
slightly wrong than waste a lot of time all the time.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 10 Aug 2011 16:08:45 +0300 |
parents | 076673c45e58 |
children | 1fb6cc545575 |
files | src/doveadm/doveadm-mail-index.c src/indexer/master-connection.c |
diffstat | 2 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/doveadm-mail-index.c Wed Aug 10 16:00:45 2011 +0300 +++ b/src/doveadm/doveadm-mail-index.c Wed Aug 10 16:08:45 2011 +0300 @@ -34,11 +34,15 @@ MAILBOX_FLAG_KEEP_RECENT | MAILBOX_FLAG_IGNORE_ACLS); if (ctx->max_recent_msgs != 0) { - /* index only if there aren't too many recent messages */ - if (mailbox_get_status(box, STATUS_RECENT, &status) < 0) { - i_error("Mailbox %s status failed: %s", info->name, + /* index only if there aren't too many recent messages. + don't bother syncing the mailbox, that alone can take a + while with large maildirs. */ + if (mailbox_open(box) < 0) { + i_error("Opening mailbox %s failed: %s", info->name, mail_storage_get_last_error(mailbox_get_storage(box), NULL)); ret = -1; + } else { + mailbox_get_open_status(box, STATUS_RECENT, &status); } if (ret < 0 || status.recent > ctx->max_recent_msgs) { mailbox_free(&box);
--- a/src/indexer/master-connection.c Wed Aug 10 16:00:45 2011 +0300 +++ b/src/indexer/master-connection.c Wed Aug 10 16:08:45 2011 +0300 @@ -64,11 +64,15 @@ "n% competed" notifications */ box = mailbox_alloc(ns->list, mailbox, MAILBOX_FLAG_KEEP_RECENT); if (max_recent_msgs != 0) { - /* index only if there aren't too many recent messages */ - if (mailbox_get_status(box, STATUS_RECENT, &status) < 0) { - i_error("Mailbox %s status failed: %s", mailbox, + /* index only if there aren't too many recent messages. + don't bother syncing the mailbox, that alone can take a + while with large maildirs. */ + if (mailbox_open(box) < 0) { + i_error("Opening mailbox %s failed: %s", mailbox, mail_storage_get_last_error(mailbox_get_storage(box), NULL)); ret = -1; + } else { + mailbox_get_open_status(box, STATUS_RECENT, &status); } if (ret < 0 || status.recent > max_recent_msgs) { mailbox_free(&box);