]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Write forced cache decision changes immediately to cache file
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 24 Jan 2018 16:01:48 +0000 (18:01 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 29 Jan 2018 13:22:05 +0000 (15:22 +0200)
When mail_always/never_cache_fields doesn't match the current caching
decisions in the cache file, write the updated decisions to the file.

src/lib-index/mail-cache-fields.c

index ca16bb054498d29595445e1ea181f42605d634ca..557c232dd3d0e7c0c31b8c48df86c98054d580ef 100644 (file)
@@ -405,7 +405,10 @@ int mail_cache_header_fields_read(struct mail_cache *cache)
                        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. */