powersync-ja / react-native-quick-sqlite

Embedded SQLite with JSI bindings
MIT License
6 stars 2 forks source link

[Fix] Watched queries with large commits #26

Closed stevensJourney closed 6 months ago

stevensJourney commented 6 months ago

Recently it was discovered that watched queries could fail when large data volumes were involved.

This behaviour was traced down to the SQLite commit hooks firing before the commit has completed executing. The commit operation takes longer for larger data volumes, which causes watched queries to trigger before the data is available.

This removes the use of the SQLite commit hook for flushing table changes. Tables changes are instead flushed when the write lock is freed. This is slightly less optimal, but is guaranteed for all data to be available before triggering table change notifications.