diff --git a/index.js b/index.js index da97377..7b90a24 100644 --- a/index.js +++ b/index.js @@ -18,6 +18,16 @@ const httpsAgent = new https.Agent({ keepAlive: true }); +httpsAgent.originalCreateConnection = httpsAgent.createConnection +httpsAgent.createConnection = function(port, host, options) { + /* noDelay is documented as defaulting to true, but docs lie. + this sacrifices throughput for latency and should be faster + for how we submit data. */ + var socket = httpsAgent.originalCreateConnection(port, host, options); + socket.setNoDelay(true); + return socket +} + // Default on module load; changed to false on first handler invocation. var COLDSTART = true