define a configurable default timeout for all request, and provide timeouts for specific requests
osher opened this issue · comments
Hi,
I was looking for a way to provide timeouts to specific calls, and/or default timeout for all requests.
I concluded that there is no such thing, because searching for "timeout" in nano.js yields nothing (where I expected some entries - at least in the relax function...)
Personally I think that's something that should be facilitated by such a good infrastructure.
If I'm just misreading the picture - I'd be delighted to be directed to how it's done.
If in deed it's not implemented - then - If it fits the spirit here - would you like a PR to add such functionality?
What I propose to do is:
1 - add handling of options.timeout
in the relax
function
2 - replace access to the higher relax
to calls from all methods of doc-scope to calls to an enclosed relax
- one that works with the dbName
of the "docScope" - and db.timeout
.
3 - expose the enclosed relax
on docScope so it can be used with the defaults enclosed for it
4 - have the enclosed db.relax
uses db.timeout
as timeout
to pass to higher relax
mmm - I'm not sure what would be more useful: if timeout should compare against begining of accepting content from the server, or a "brutal" timeout - i.e - compares against completion of response...
let me know what you think. We can implement both, however, the 2nd is simpler.
Thoughts?
I think you can specify the default timeout
with requestDefaults
, not sure about specifying a timeout for each request.
This repository has been merged into apache/couchdb-nano, please continue the discussion here.