appy-one / acebase-client

Client to connect to remote AceBase NoSQL database server
MIT License
21 stars 8 forks source link

Using missing cache value instead of server value #15

Closed appy-one closed 2 years ago

appy-one commented 2 years ago

I discovered an issue where .get API method returns a null (non-existent) value from cache upon timeout, because the server value is large and takes some time to download. In this case it MUST wait for the server value to arrive, and NOT use the value from cache. After some research, I discovered this is caused by a recent commit in web-api.js:1588 - val is now an object containing both value and context, but in line 1595 it still uses val instead of value to check for existence; so .get will return null as the current value. This is a major problem for live data proxies that use a default value if the target path does not exist, because it will overwrite the value after this faulty response!

Note this only applies to AceBaseClient's using a local cache database, when fetching a value from the server that takes more than a second to load (1000ms is the timeout for delivering the cached value)

appy-one commented 2 years ago

Fix published with acebase-client 1.8.2