From c81e601550264dc1f99591200ed2727dba12b425 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Mon, 30 Jan 2017 21:57:33 -0800 Subject: [PATCH 1/2] add default for pool --- README.md | 5 +++++ lib/bing.js | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index da72e24..de9806e 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,11 @@ Available Options: * preContextText:\<*String*\> * postContextText:\<*String*\> +### request() options + +* maxSockets: integer (default: Infinity) +* reqTimeout: ms + #### Specify Market Getting spanish results: ```js diff --git a/lib/bing.js b/lib/bing.js index a9f322d..2ef69bf 100644 --- a/lib/bing.js +++ b/lib/bing.js @@ -84,7 +84,10 @@ var Bing = function (options) { "User-Agent": opts.userAgent, "Ocp-Apim-Subscription-Key": opts.accKey }, - timeout: opts.reqTimeout + timeout: opts.reqTimeout, + pool: { + maxSockets: opts.maxSockets || Infinity + } }, function (err, res, body) { From 6f365c52a8753c6d0461479a5d757fe1977d1d8d Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Mon, 30 Jan 2017 22:07:50 -0800 Subject: [PATCH 2/2] safety check --- lib/bing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bing.js b/lib/bing.js index 2ef69bf..40469da 100644 --- a/lib/bing.js +++ b/lib/bing.js @@ -86,7 +86,7 @@ var Bing = function (options) { }, timeout: opts.reqTimeout, pool: { - maxSockets: opts.maxSockets || Infinity + maxSockets: opts.maxSockets ? opts.maxSockets : Infinity } }, function (err, res, body) {