Skip to content

Commit a3e6c0a

Browse files
author
Matthew Fisher
committed
fix: remove dependency on net-keepalive
node's net socket.setKeepAlive has an optional initial delay parameter. By setting this, it will request that the socket sends a TCP keep-alive probe every N milliseconds, removing the need for net-keepalive which is not portable. https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay Signed-off-by: Matthew Fisher <[email protected]>
1 parent a3e1501 commit a3e6c0a

File tree

3 files changed

+6
-87
lines changed

3 files changed

+6
-87
lines changed

package-lock.json

Lines changed: 5 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"isomorphic-ws": "^4.0.1",
6767
"js-yaml": "^3.13.1",
6868
"jsonpath-plus": "^0.19.0",
69-
"net-keepalive": "2.0.4",
7069
"openid-client": "^4.1.1",
7170
"request": "^2.88.0",
7271
"rfc4648": "^1.3.0",

src/watch.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import byline = require('byline');
2-
import keepalive = require('net-keepalive');
32
import request = require('request');
43
import { Duplex } from 'stream';
54
import { KubeConfig } from './config';
@@ -115,8 +114,7 @@ export class Watch {
115114
req.on('error', doneCallOnce);
116115
req.on('socket', (socket) => {
117116
socket.setTimeout(30000);
118-
socket.setKeepAlive(true);
119-
keepalive.setKeepAliveInterval(socket, 30000);
117+
socket.setKeepAlive(true, 30000);
120118
});
121119
stream.on('error', doneCallOnce);
122120
stream.on('close', () => doneCallOnce(null));

0 commit comments

Comments
 (0)