-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support request timeout as option #177
Comments
Hey @phamann, Thanks for the suggestion — it's a good one. I have a few thoughts. One is that I always go back and forth on whether to expose Request's raw options directly. There are a lot of good ones, so it'd be powerful for cases where people need custom/uncommon functionality. But ultimately, I lean towards not exposing that implementation detail directly, in case it changes at some point. (E.g. with v2, I took a stab at not using Request at all (but ultimately brought it back for easy gzip support). And in the future, I might consider Superagent, for better browser-side compat.) With request timeout specifically, that's definitely important, but my understanding and impression is that that's better to specify at the Neo4j config level (which is what we at @fiftythree do too): http://www.markhneedham.com/blog/2013/10/17/neo4j-setting-query-timeout/ The two relevant configs being I believe those are better because it ensures that Neo4j actually stops processing the query, as opposed to just aborting the connection (which is what Request's timeout would do). (To be fair, aborting the connection might "just work" too, but I'm not sure.) The blog post also mentions a We've actually had issue #13 open for a long time, to support passing this header. Good to know this is fixed in v2. Hope all this helps! Let me know if you have any other q's. |
I'll go ahead close this question as answered for now, but feel free to re-open. |
@aseemk Thank you very much for the detailed response, it's greatly appreciated. We didn't know about the Therefore, happy for you to close. |
Whilst trying to tune our DB connection, we have realised it would be useful to expose
Request
's max timeout option in the options hash supplied when creating a newGraphDatabase
instance.Such as:
Like the new headers support in v2, this could also then be overridden at a request level.
I'm happy to attempt submitting this change as a PR, but wanted to post here first and discuss the desired interface before doing the work.
In the interim we are suppling a custom
new
http.Agent` with keep-alive and max sockets enabled. Any other suggestions you have for http tuning would be great.The text was updated successfully, but these errors were encountered: