mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 10:28:09 +01:00
lib/n_d_remove_message: do not remove unique filename
It is wasteful to remove a filename term when the whole message document is about to be removed from the database. Profiling with perf shows this takes a significant portion of the time when cleaning up removed files in the database. The logic of n_d_remove_message becomes a bit more convoluted here in order to make the change minimal. It is possible that this function can be further optimized, since the expansion of filename terms into filenames is probably not needed here.
This commit is contained in:
parent
d93d49b6ae
commit
b6f144abe1
1 changed files with 3 additions and 1 deletions
|
@ -1454,7 +1454,9 @@ notmuch_database_remove_message (notmuch_database_t *notmuch,
|
||||||
&message);
|
&message);
|
||||||
|
|
||||||
if (status == NOTMUCH_STATUS_SUCCESS && message) {
|
if (status == NOTMUCH_STATUS_SUCCESS && message) {
|
||||||
status = _notmuch_message_remove_filename (message, filename);
|
if (notmuch_message_count_files (message) > 1) {
|
||||||
|
status = _notmuch_message_remove_filename (message, filename);
|
||||||
|
}
|
||||||
if (status == NOTMUCH_STATUS_SUCCESS)
|
if (status == NOTMUCH_STATUS_SUCCESS)
|
||||||
status = _notmuch_message_delete (message);
|
status = _notmuch_message_delete (message);
|
||||||
else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
|
else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
|
||||||
|
|
Loading…
Reference in a new issue