dovecot-2.1: lib-index: If cache field's decision is forced no, ...

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 10 08:35:11 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/95524ab3469f
changeset: 13840:95524ab3469f
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 10 08:35:06 2011 +0200
description:
lib-index: If cache field's decision is forced no, don't update the field's last_used.

diffstat:

 src/lib-index/mail-cache-decisions.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r fcceee891448 -r 95524ab3469f src/lib-index/mail-cache-decisions.c
--- a/src/lib-index/mail-cache-decisions.c	Sat Dec 10 08:15:58 2011 +0200
+++ b/src/lib-index/mail-cache-decisions.c	Sat Dec 10 08:35:06 2011 +0200
@@ -74,6 +74,7 @@
 				      uint32_t seq, unsigned int field)
 {
 	struct mail_cache *cache = view->cache;
+	enum mail_cache_decision_type dec;
 	const struct mail_index_header *hdr;
 	uint32_t uid;
 
@@ -82,8 +83,11 @@
 	if (view->no_decision_updates)
 		return;
 
-	mail_index_lookup_uid(view->view, seq, &uid);
-	hdr = mail_index_get_header(view->view);
+	dec = cache->fields[field].field.decision;
+	if (dec == (MAIL_CACHE_DECISION_NO | MAIL_CACHE_DECISION_FORCED)) {
+		/* don't update last_used */
+		return;
+	}
 
 	if (ioloop_time - cache->fields[field].last_used > 3600*24) {
 		/* update last_used about once a day */
@@ -92,13 +96,16 @@
 			cache->field_header_write_pending = TRUE;
 	}
 
-	if (cache->fields[field].field.decision != MAIL_CACHE_DECISION_TEMP) {
+	if (dec != MAIL_CACHE_DECISION_TEMP) {
 		/* a) forced decision
 		   b) not cached, mail_cache_decision_add() will handle this
 		   c) permanently cached already, okay. */
 		return;
 	}
 
+	mail_index_lookup_uid(view->view, seq, &uid);
+	hdr = mail_index_get_header(view->view);
+
 	/* see if we want to change decision from TEMP to YES */
 	if (uid < cache->fields[field].uid_highwater ||
 	    uid < hdr->day_first_uid[7]) {


More information about the dovecot-cvs mailing list