Global agent is being used when pool is specified #596

Merged
merged 1 commit into from Jul 23, 2013

Projects

None yet

3 participants

@Cauldrath
Contributor

When making a request of the form

request({
  uri: "http://localhost:4000",
  pool: {
    maxSockets: 1
  }
}, function(error, response, body) {
});

this.agent is still being set to this.httpModule.globalAgent, and then the global maxSockets is being overwritten with whatever is specified for the pool, which, in this case, is 1.

I'm not sure if this is the best way to check for this, but this change does fix the issue while still leaving an undefined pool as using the global agent and a false agent as not using a pool.

@mikeal
Member
mikeal commented Jul 23, 2013

does a regular comparison just work in this case?

i wish we had a test for this.

@mikeal mikeal merged commit b8495e5 into request:master Jul 23, 2013
@nemtsov
nemtsov commented on de8508e Aug 5, 2013

I believe this commit is the cause of issue #617 (globalPool not used when maxSockets are set); test is provided in the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment