changeset 22774:76387cd37d39

lib-index: Write forced cache decision changes immediately to cache file When mail_always/never_cache_fields doesn't match the current caching decisions in the cache file, write the updated decisions to the file.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 24 Jan 2018 18:01:48 +0200
parents dbdb73e0a95a
children 33c6edfacf8d
files src/lib-index/mail-cache-fields.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-cache-fields.c	Wed Jan 24 18:01:23 2018 +0200
+++ b/src/lib-index/mail-cache-fields.c	Wed Jan 24 18:01:48 2018 +0200
@@ -405,7 +405,10 @@
 			enum mail_cache_decision_type cur_dec =
 				cache->fields[fidx].field.decision;
 			if ((cur_dec & MAIL_CACHE_DECISION_FORCED) != 0) {
-				/* Forced decision. */
+				/* Forced decision. If the decision has
+				   changed, update the fields in the file. */
+				if ((cur_dec & ~MAIL_CACHE_DECISION_FORCED) != file_dec)
+					cache->field_header_write_pending = TRUE;
 			} else if (cache->fields[fidx].decision_dirty) {
 				/* Decisions have recently been updated
 				   internally. Don't change them. */