changeset 10244:a5e545002bf5 HEAD

lib-index: Don't refresh index after transaction commit if nothing was changed.
author Timo Sirainen <tss@iki.fi>
date Mon, 02 Nov 2009 18:02:48 -0500
parents 9c4740670030
children 4acd259d2b9c
files src/lib-index/mail-index-transaction.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-transaction.c	Mon Nov 02 13:39:54 2009 -0500
+++ b/src/lib-index/mail-index-transaction.c	Mon Nov 02 18:02:48 2009 -0500
@@ -158,12 +158,14 @@
 					   uoff_t *log_file_offset_r)
 {
 	struct mail_index *index = t->view->index;
+	bool changed;
 	int ret;
 
 	i_assert(t->first_new_seq >
 		 mail_index_view_get_messages_count(t->view));
 
-	if (!MAIL_INDEX_TRANSACTION_HAS_CHANGES(t) && !t->reset) {
+	changed = MAIL_INDEX_TRANSACTION_HAS_CHANGES(t) || t->reset;
+	if (!changed) {
 		/* nothing to append */
 		ret = 0;
 	} else {
@@ -172,7 +174,7 @@
 	mail_transaction_log_get_head(index->log, log_file_seq_r,
 				      log_file_offset_r);
 
-	if (ret == 0 && !index->syncing) {
+	if (ret == 0 && !index->syncing && changed) {
 		/* if we're committing a normal transaction, we want to
 		   have those changes in the index mapping immediately. this
 		   is especially important when committing cache offset