arj03 / ssb-browser-demo

A secure scuttlebutt client interface running in the browser
Other
58 stars 11 forks source link

When browser's running slow, new-public-messages can error #279

Closed KyleMaas closed 3 years ago

KyleMaas commented 3 years ago

new-public-messages calls the syncronous version of getSSB() and then checks for an error. Unfortunately, this means that if the browser is running exceptionally slowly (such as in a resource-constrained environment), new-public-messages can end up trying to run SSB.db.query() on an SSB object which doesn't have a db yet. The err check needs to also check for the presence of SSB.db and retry if it's not initialized yet.