We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 673e7ac commit 203fdc6Copy full SHA for 203fdc6
1 file changed
src/mongoPatch.ts
@@ -8,6 +8,9 @@ interface Config {
8
/** The journey apps cc egress proxy domain */
9
proxy: string;
10
}
11
+
12
+const originalCreateConnection = socks.SocksClient.createConnection;
13
14
/**
15
* The patch should be called before instantiating the MongoClient
16
* @param config - The configuration for the proxy
@@ -30,12 +33,16 @@ export function useProxyForMongo(config: Config) {
30
33
sockets.map(
31
34
(socket) =>
32
35
new Promise<void>((resolve) => {
- socket.once('close', resolve);
36
+ socket.once('close', ()=>{
37
+ console.log('Socket closed');
38
+ resolve();
39
+ });
40
socket.destroy();
41
}),
42
),
43
);
44
sockets.length = 0;
45
+ socks.SocksClient.createConnection = originalCreateConnection;
46
},
47
};
48
0 commit comments