]> git.notmuchmail.org Git - notmuch/commitdiff
new: Add all initial tags at once
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 21 Jan 2011 09:59:36 +0000 (10:59 +0100)
committerCarl Worth <cworth@cworth.org>
Wed, 26 Jan 2011 12:05:28 +0000 (22:05 +1000)
If there are several tags applied to the new messages, it is beneficial
to store them to the database at one, because it saves some time,
especially when the notmuch new is run for the first time.

This patch decreased the time for initial import from 1h 35m to 1h 14m.

notmuch-new.c

index 7aa0674d186c3fbd8a71e42460338a5232c237a9..c4b7da38afe07ede1b998cd082298f9f2f75577a 100644 (file)
@@ -418,10 +418,12 @@ add_files_recursive (notmuch_database_t *notmuch,
        /* success */
        case NOTMUCH_STATUS_SUCCESS:
            state->added_messages++;
        /* success */
        case NOTMUCH_STATUS_SUCCESS:
            state->added_messages++;
+           notmuch_message_freeze (message);
            for (tag=state->new_tags; *tag != NULL; tag++)
                notmuch_message_add_tag (message, *tag);
            if (state->synchronize_flags == TRUE)
                notmuch_message_maildir_flags_to_tags (message);
            for (tag=state->new_tags; *tag != NULL; tag++)
                notmuch_message_add_tag (message, *tag);
            if (state->synchronize_flags == TRUE)
                notmuch_message_maildir_flags_to_tags (message);
+           notmuch_message_thaw (message);
            break;
        /* Non-fatal issues (go on to next file) */
        case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
            break;
        /* Non-fatal issues (go on to next file) */
        case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: