dovecot-2.2: fts: If precaching fails, stop precaching the rest ...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 29 08:52:35 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/485ed5de2473
changeset: 18758:485ed5de2473
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 29 11:50:18 2015 +0300
description:
fts: If precaching fails, stop precaching the rest of the mails.
If there are a lot of mails to be precached, this could mean that the
precaching is attempted for a long time and every one of them fails the same
way.

diffstat:

 src/plugins/fts/fts-storage.c |  10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 5e523f0bbdf8 -r 485ed5de2473 src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c	Fri May 29 11:08:29 2015 +0300
+++ b/src/plugins/fts/fts-storage.c	Fri May 29 11:50:18 2015 +0300
@@ -281,6 +281,13 @@
 {
 	struct fts_mailbox *fbox = FTS_CONTEXT(ctx->transaction->box);
 	struct fts_search_context *fctx = FTS_CONTEXT(ctx);
+	struct fts_transaction_context *ft = FTS_CONTEXT(ctx->transaction);
+
+	if (fctx == NULL && ft->failed) {
+		/* precaching already failed - stop now instead of potentially
+		   going through the same failure for all the mails */
+		return FALSE;
+	}
 
 	if (fctx != NULL && fctx->indexer_ctx != NULL) {
 		/* this command is still building the indexes */
@@ -381,6 +388,9 @@
 		pool_unref(&fctx->result_pool);
 		fts_scores_unref(&fctx->scores);
 		i_free(fctx);
+	} else {
+		if (ft->failed)
+			ret = -1;
 	}
 	if (fbox->module_ctx.super.search_deinit(ctx) < 0)
 		ret = -1;


More information about the dovecot-cvs mailing list