tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
182 stars 30 forks source link

Sync interval option doesn't work (mismatch with name in libsql Database constructor) #203

Closed Hedrekao closed 1 month ago

Hedrekao commented 2 months ago

When trying to create client with sync interval, in reality automatic periodic syncs never happen, due to the fact that in sqlite3.js file, following object is passed to Database constructor:

image However, constructor in file index.js from libsql package expects field syncPeriod instead of syncInterval

image

Therefore value of syncPeriod is set to 0 and db doesn't do any automatic periodic syncs.

sudhir-b commented 1 month ago

I'd love to try to fix this in a PR - is it sufficient to update options so that it passes through syncPeriod: config.syncInterval, or is it more correct to change the whole interface so that we replace syncInterval with syncPeriod everywhere? The syncInterval option has made its way into docs which makes me think the former option is the preferred approach

sudhir-b commented 1 month ago

Opened PR #209 for this