changeset 18676:5483aeb1ce9b

fts-solr: Don't update "last indexed UID" if we couldn't actually add the mails to Solr.
author Timo Sirainen <tss@iki.fi>
date Wed, 13 May 2015 16:46:14 +0300
parents 52cdf321fa07
children e6e04177374d
files src/plugins/fts-solr/fts-backend-solr.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/fts-solr/fts-backend-solr.c	Wed May 13 16:22:27 2015 +0300
+++ b/src/plugins/fts-solr/fts-backend-solr.c	Wed May 13 16:46:14 2015 +0300
@@ -401,7 +401,12 @@
 	const char *box_guid;
 
 	if (ctx->prev_uid != 0) {
-		fts_index_set_last_uid(ctx->cur_box, ctx->prev_uid);
+		/* flush solr between mailboxes, so we don't wrongly update
+		   last_uid before we know it has succeeded */
+		if (fts_backed_solr_build_commit(ctx) < 0)
+			_ctx->failed = TRUE;
+		else if (!_ctx->failed)
+			fts_index_set_last_uid(ctx->cur_box, ctx->prev_uid);
 		ctx->prev_uid = 0;
 	}