pouchdb-server icon indicating copy to clipboard operation
pouchdb-server copied to clipboard

Need to respect timeout option

Open daleharvey opened this issue 10 years ago • 3 comments

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

daleharvey avatar Nov 16 '14 23:11 daleharvey

Still an issue; I can confirm that packages/node_modules/express-pouchdb/lib/routes/changes.js does not check for timeout anywhere.

nolanlawson avatar Feb 18 '17 21:02 nolanlawson

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.

nolanlawson avatar Feb 18 '17 22:02 nolanlawson

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 completes 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

codingismy11to7 avatar Jan 11 '21 15:01 codingismy11to7