We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9900087 commit 4491c9bCopy full SHA for 4491c9b
1 file changed
src/mongoPatch.ts
@@ -17,6 +17,7 @@ export function useProxyForMongo(config: Config) {
17
socks.SocksClient.createConnection = async (options, callback) => {
18
const proxy = new HttpsProxySocket(`https://${config.proxy}`, { auth: config.auth });
19
const socket = await proxy.connect({ host: options.destination.host, port: options.destination.port });
20
+ socket.unref()
21
sockets.push(socket);
22
return {
23
socket,
@@ -27,10 +28,7 @@ export function useProxyForMongo(config: Config) {
27
28
console.log(`Closing ${sockets.length} open proxy sockets`);
29
for (const socket of sockets) {
30
await new Promise((resolve, reject) => {
- socket.on('close', () => {
31
- socket.unref();
32
- resolve(true);
33
- });
+ socket.on('close', () => resolve);
34
socket.end();
35
});
36
}
0 commit comments