Automattic / simplenote-android

Simplenote for Android
https://simplenote.com
GNU General Public License v2.0
1.75k stars 299 forks source link

Fix ANR related to note count indexing #1629

Closed roundhill closed 5 months ago

roundhill commented 5 months ago

Fix #1621

The app has a separate Simperium indexer to keep track of how many notes are in a tag. The query for the indexer was using a LIKE comparator which was causing very slow queries when a user has a lot of notes (From my testing, above 400 would cause the ANR)

Test

  1. To reproduce, build the app without this branch and launch the app with around 500 notes in an account. It may need a few tags assigned to some notes as well. Right after launch the app will freeze as the note count indexer goes bananas with long running LIKE queries.
  2. Apply patch, restart. The app should be responsive-ish straight away!
  3. Tap on edit tags, the note count displayed there should be accurate.
  4. Search for a tag in the search bar, it should show up in the results and work as expected.

Review

One developer!

Release

RELEASE-NOTES.txt was updated in fc052ab with: Fixed the app from becoming unresponsive at launch with a large amount of notes.

wpmobilebot commented 5 months ago
You can test the changes on this Pull Request by downloading an installable build (simplenote-android-installable-build-pr1629-0a1aa37-018d37ff-e788-4b45-abe3-252b4df2f1ec.apk), or scanning this QR code: