We were incorrectly only destroying messages in the case of
successful addition to the database, and not in other cases,
(such as failure due to FILE_NOT_EMAIL).
I'm still not entirely sure why this was performing abysmally, (as in
making an operation that should take a small fraction of a second take
10 seconds), nor why it was causing the database to entirely fail to
get new results.
But fortunately, this all seems to work now.
char *next = NULL;
time_t path_mtime, path_dbtime;
notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS;
char *next = NULL;
time_t path_mtime, path_dbtime;
notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS;
- notmuch_message_t *message, **closure;
+ notmuch_message_t *message = NULL, **closure;
/* If we're told to, we bail out on encountering a read-only
* directory, (with this being a clear clue from the user to
/* If we're told to, we bail out on encountering a read-only
* directory, (with this being a clear clue from the user to
/* success */
case NOTMUCH_STATUS_SUCCESS:
state->added_messages++;
/* success */
case NOTMUCH_STATUS_SUCCESS:
state->added_messages++;
(state->callback) (message);
(state->callback) (message);
- notmuch_message_destroy (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:
INTERNAL_ERROR ("add_message returned unexpected value: %d", status);
goto DONE;
}
INTERNAL_ERROR ("add_message returned unexpected value: %d", status);
goto DONE;
}
+
+ if (message) {
+ notmuch_message_destroy (message);
+ message = NULL;
+ }
+
if (state->processed_files % 1000 == 0)
add_files_print_progress (state);
}
if (state->processed_files % 1000 == 0)
add_files_print_progress (state);
}