dovecot-2.2: dsync: Avoid a creating a lot of searches for each ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 20 20:57:09 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/1a5a0b7cf37a
changeset: 16068:1a5a0b7cf37a
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Mar 20 20:47:14 2013 +0200
description:
dsync: Avoid a creating a lot of searches for each synced mailbox.

diffstat:

 src/doveadm/dsync/dsync-brain-mails.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (31 lines):

diff -r 19ce7403114f -r 1a5a0b7cf37a src/doveadm/dsync/dsync-brain-mails.c
--- a/src/doveadm/dsync/dsync-brain-mails.c	Wed Mar 20 20:24:31 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain-mails.c	Wed Mar 20 20:47:14 2013 +0200
@@ -242,18 +242,20 @@
 static bool dsync_brain_send_mail(struct dsync_brain *brain)
 {
 	const struct dsync_mail *mail;
-	bool changed = FALSE;
+
+	if (brain->mail_requests &&
+	    brain->box_recv_state < DSYNC_BOX_STATE_MAILS) {
+		/* wait for mail requests to finish. we could already start
+		   exporting, but then we're going to do quite a lot of
+		   separate searches. especially with pipe backend we'd do
+		   a separate search for each mail. */
+		return FALSE;
+	}
 
 	while ((mail = dsync_mailbox_export_next_mail(brain->box_exporter)) != NULL) {
-		changed = TRUE;
 		if (dsync_ibc_send_mail(brain->ibc, mail) == 0)
 			return TRUE;
 	}
-	if (brain->mail_requests &&
-	    brain->box_recv_state < DSYNC_BOX_STATE_MAILS) {
-		/* wait for mail requests to finish */
-		return changed;
-	}
 
 	brain->box_send_state = DSYNC_BOX_STATE_DONE;
 	dsync_ibc_send_end_of_list(brain->ibc);


More information about the dovecot-cvs mailing list