You answered your own question. If I store passwords in a pouchdb replacing the current storage (which is very desirable and would greatly reduce complexity), and I am inside searchLogin() and I am supposed to immediately return a login, how do I do that from a pouchdb that is async and only has async backends. I can spin the event loop or I can block on pouchdb on a different thread. Both approaches suck.
Sent from Mobile. On Jul 26, 2013, at 12:05, Gavin Sharp <[email protected]> wrote: > On Fri, Jul 26, 2013 at 11:53 AM, Andreas Gal <[email protected]> wrote: >> The main problem we are running into here >> is that the password manager for example is completely synchronous. The API >> is of the form x = searchLogin(needle). This can't be changed easily because >> there is layers and layers of APIs around this API all across the codebase >> that are also synchronous. Rewriting all of that to take a result callback >> would take at least a couple months. Its righteous work, but it takes time, >> and it doesn't really solve a performance problem because this code path is >> very rarely taken. > > Why is this a problem? We can easily fake an async API by just posting > an event, while using the synchronous API under the hood (as the patch > in bug 853549 does, as a first step to asyncifying pwmgr without > breaking backwards-compatibility). Obviously doesn't solve the > underlying main-thread responsiveness issue, but it's no worse than > what we have now. > >> The solution old sync took (make a synchronous call, spin >> the event loop while waiting, continue) is really terrible and we should not >> go down that path. > > That's the solution that sync took to do the opposite, i.e. turn async > APIs in into synchronous ones. Agreed that it's horrible! > > Gavin _______________________________________________ Sync-dev mailing list [email protected] https://mail.mozilla.org/listinfo/sync-dev

