From 09b36861ed48e791d346a976e9043ccdc33ac37f Mon Sep 17 00:00:00 2001 From: Dotan Date: Thu, 10 Oct 2019 16:24:53 +0300 Subject: [PATCH] Make socket keepAlive time configurable --- lib/kafkaClient.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/kafkaClient.js b/lib/kafkaClient.js index 1debd7bd..27e15f69 100644 --- a/lib/kafkaClient.js +++ b/lib/kafkaClient.js @@ -43,7 +43,8 @@ const DEFAULTS = { randomize: true }, maxAsyncRequests: 10, - noAckBatchOptions: null + noAckBatchOptions: null, + socketKeepAlive: 60000 }; const KafkaClient = function (options) { @@ -796,7 +797,7 @@ KafkaClient.prototype.createBroker = function (host, port, longpolling) { socket.buffer.append(data); self.handleReceivedData(socket); }); - socket.setKeepAlive(true, 60000); + socket.setKeepAlive(true, self.options.socketKeepAlive); const brokerWrapper = new BrokerWrapper( socket,