]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Delay recreating event when closing mail
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 15 Oct 2020 17:34:05 +0000 (20:34 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 23 Oct 2020 07:22:50 +0000 (07:22 +0000)
If the mail isn't reused, the event is unnecessary.

src/lib-storage/index/index-mail.c

index bc5c89bd81491286b122fdf12787975d51aa0b1a..61e6bfb3d85ba35966420a30d1d670d045f96f40 100644 (file)
@@ -1794,7 +1794,6 @@ void index_mail_close(struct mail *_mail)
        /* make sure old mail isn't visible in the event anymore even if it's
           attempted to be used. */
        event_unref(&_mail->event);
-       index_mail_init_event(&mail->mail.mail);
 
        /* If uid == 0 but seq != 0, we came here from saving a (non-mbox)
           message. If that happens, don't bother checking if anything should
@@ -2031,6 +2030,8 @@ void index_mail_set_seq(struct mail *_mail, uint32_t seq, bool saving)
        mail_index_lookup_uid(_mail->transaction->view, seq,
                              &mail->mail.mail.uid);
 
+       if (_mail->event == NULL)
+               index_mail_init_event(_mail);
        event_add_int(_mail->event, "seq", _mail->seq);
        event_add_int(_mail->event, "uid", _mail->uid);
        event_set_append_log_prefix(_mail->event, t_strdup_printf(