From d577f4b9af672954c34cb80a438c16bbc289fc71 Mon Sep 17 00:00:00 2001 From: "Jonah H. Harris" Date: Tue, 15 Mar 2016 18:08:45 -0400 Subject: [PATCH] Add proper support of http.Agent keepAlive --- src/lib/connectors/http.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/connectors/http.js b/src/lib/connectors/http.js index 9feca60ae..d1c28cea8 100644 --- a/src/lib/connectors/http.js +++ b/src/lib/connectors/http.js @@ -88,6 +88,15 @@ HttpConnector.prototype.createAgent = function (config) { HttpConnector.prototype.makeAgentConfig = function (config) { var agentConfig = { + /* + * As HTTP/HTTPS Agent defaults keepAlive to false, in the case where we + * desire HTTP keep-alive, we need to set it appropriately. This could be + * done in the wrapper, but I don't see any good reason not to simply set + * it here. ¯\_(ツ)_/¯ + * + * https://github.com/elastic/elasticsearch-js/issues/107 + */ + keepAlive: config.keepAlive, maxSockets: config.maxSockets, minSockets: config.minSockets };