]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lazy-expunge: Add MAIL_FETCH_REFCOUNT to mail's wanted_fields
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 28 Nov 2019 17:38:10 +0000 (19:38 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 31 Jan 2020 11:01:17 +0000 (11:01 +0000)
The mail is reused by the search query, so the next mail_prefetch() can try
to prefetch the refcount.

src/plugins/lazy-expunge/lazy-expunge-plugin.c

index 970129184b0819ab08a86083e0c90b150878a6bb..7bdf507ac4dbfc36afec60bf0fe32ac36171dcaf 100644 (file)
@@ -184,12 +184,17 @@ lazy_expunge_count_in_transaction(struct lazy_expunge_transaction *lt,
 
 static int lazy_expunge_mail_is_last_instance(struct mail *_mail)
 {
+       struct mail_private *mail = (struct mail_private *)_mail;
        struct lazy_expunge_transaction *lt =
                LAZY_EXPUNGE_CONTEXT_REQUIRE(_mail->transaction);
        const char *value, *errstr;
        unsigned long refcount;
        enum mail_error error;
 
+       /* mail is reused by the search query, so the next mail_prefetch() on
+          it will try to prefetch the refcount */
+       mail->wanted_fields |= MAIL_FETCH_REFCOUNT;
+
        if (mail_get_special(_mail, MAIL_FETCH_REFCOUNT, &value) < 0) {
                errstr = mailbox_get_last_internal_error(_mail->box, &error);
                if (error == MAIL_ERROR_EXPUNGED) {