Skip to content
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

Clean up some code around setting the agent #1197

Merged
merged 1 commit into from
Oct 24, 2014

Conversation

FredKSchott
Copy link
Contributor

Some small cleanup around setting and getting the http/https agent. Looks like maxSockets weren't getting properly set when outside of init, so I moved that logic into getAgent(), which has been renamed to _chooseAgent() since it doesn't literally get the current agent, as the name suggests. (Underscore added since it looks like it should only be called privately) (happy to bikeshed on a name, I'm not particularly tied to _chooseAgent and I'm sure there are better names out there)

@mikeal I'd want your sign off on this since it's touching some older code

@@ -626,15 +626,7 @@ Request.prototype.init = function (options) {
if (self.pool === false) {
self.agent = false
} else {
self.agent = self.agent || self.getAgent()
if (self.maxSockets) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this was an older setting we haven't supported in a while

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, this was originally, if i remember correctly, intended to straddle compatibility between two major releases of Node with maxSocket changes. we can deprecate.

@nylen
Copy link
Member

nylen commented Oct 24, 2014

👍 from me, but I agree comment from @mikeal would be good.

@mikeal
Copy link
Member

mikeal commented Oct 24, 2014

+1 from me. keep in mind that I wrote this code years ago so my memory may be a little off but we have pretty good tests for this stuff.

nylen added a commit that referenced this pull request Oct 24, 2014
Clean up some code around setting the agent
@nylen nylen merged commit fb7d029 into request:master Oct 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants