-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make import a bit faster by bulk-inserting SMS messages
Importing is very slow when there are a lot of messages. The new code is a bit faster, but unfortunately still rather slow. There isn't much more that we can do because the majority of the time is spent in the bulkInsert() call waiting for the Telephony provider, so it's outside our control. The new code has mostly the same behaviour as the old code, but there are some differences: - The error handling isn't perfect. If one message in a batch causes an error, then the other messages in that batch may not be imported. (The previous code tried to import every single message even if some of them caused exceptions.) It's possible to change the code so that it re-tries the messages individually when a batch fails, but that's complicated. - Existing messages are skipped as before, however if the backup file itself contains duplicate messages then they might not be de-duplicated (it depends on whether they get processed in the same batch). - If there are errors while querying for existing messages, they are displayed using a toast. The old code (which still exists but is now unused) silently ignores errors in the queryCursor() call; it's not clear to me whether that's intentional. The new code is more complicated, so it's important to know if it fails, and the batching significantly reduces the number of toasts that might be shown. This commit doesn't use bulk-insert for MMS, because that's more complicated and because MMS messages are typically large so the overhead of single insertion is less significant. Fixes #TODO.
- Loading branch information
Showing
2 changed files
with
69 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters