]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Generate snippet while saving new mails
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Sun, 18 Feb 2018 23:07:16 +0000 (18:07 -0500)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 19 Feb 2018 13:43:52 +0000 (15:43 +0200)
src/lib-storage/index/index-mail-headers.c

index 3ea2dc1e16b97668e1eb82208477dce1fcdb3413..8bd356f89f4880d11610171405c8088070c0b959 100644 (file)
@@ -384,6 +384,10 @@ index_mail_cache_parse_init(struct mail *_mail, struct istream *input)
        mail->data.save_sent_date = TRUE;
        mail->data.save_bodystructure_header = TRUE;
        mail->data.save_bodystructure_body = TRUE;
+       /* Don't unnecessarily waste time generating a snippet, since it's
+          not as cheap as the others to generate. */
+       if (index_mail_want_cache(mail, MAIL_CACHE_BODY_SNIPPET))
+               mail->data.save_body_snippet = TRUE;
 
        mail->data.tee_stream = tee_i_stream_create(input);
        input = tee_i_stream_create_child(mail->data.tee_stream);