]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Optimize INBOX notifications with mailbox_list_index_include_inbox=yes
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 4 Sep 2017 13:55:30 +0000 (16:55 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 5 Sep 2017 07:47:28 +0000 (10:47 +0300)
There's no need for special INBOX checks in that case, because INBOX is
tracked in the mailbox list index the same as any other mailbox.

src/lib-storage/list/mailbox-list-index-notify.c

index 38b132caf4ecbabb6315ed2b1ba3e21733e397d3..33c3172fdd3ff3eb694df5a2b9dcc5fb474b1c90 100644 (file)
@@ -101,9 +101,14 @@ int mailbox_list_index_notify_init(struct mailbox_list *list,
                inotify->subscriptions = mailbox_tree_dup(list->subscriptions);
        }
        inotify->list_log_path = i_strdup(ilist->index->log->filepath);
-       if ((list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0 &&
-           mailbox_list_get_path(list, "INBOX", MAILBOX_LIST_PATH_TYPE_INDEX,
-                                 &index_dir) > 0) {
+       if (list->mail_set->mailbox_list_index_include_inbox) {
+               /* INBOX can be handled also using mailbox list index */
+       } else if ((list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) == 0) {
+               /* no INBOX in this namespace */
+       } else if (mailbox_list_get_path(list, "INBOX", MAILBOX_LIST_PATH_TYPE_INDEX,
+                                        &index_dir) <= 0) {
+               /* no indexes for INBOX? can't handle it */
+       } else {
                /* FIXME: annoyingly hardcoded filename. */
                inotify->inbox_log_path = i_strdup_printf(
                        "%s/"MAIL_INDEX_PREFIX".log", index_dir);