pouchdb-server
pouchdb-server copied to clipboard
Need to respect timeout option
http://127.0.0.1:5984/test/_changes?feed=longpoll&timeout=1000
will wait indefinitely, which breaks replication with pouchdb as it expects the server to respond nicely
Still an issue; I can confirm that packages/node_modules/express-pouchdb/lib/routes/changes.js
does not check for timeout
anywhere.
Marking this as medium; the fix is just to add a setTimeout()
to respect the timeout
option that is passed in by the user. It's difficult to add a test case for this, but the PouchDB test suite already passes in the timeout
option, so if the Travis run is green and the PR looks good, it should be okay.
Forked to band-aid this issue (and with continuous, not just longpoll), and got timeouts respected on my fork... but I'm not submitting a PR because there's bigger issues at play - changes.cancel()
never complete
s until after a change actually happens. So you can respect the timeout and close the http response, but you're still sitting around leaking memory if changes don't happen. It also makes the code more complicated, since it'd be easier (and was my first attempt) to just call cancel()
after the timeout and then handle things in the complete
handlers. Assuming this is what's being referenced in https://github.com/pouchdb/pouchdb-server/issues/187