Skip to content

Commit 7a2e07f

Browse files
authored
fix: DH-19010: Delete closed http2 sessions from the cache (#2400)
DH-19010: Delete closed http2 sessions from the cache. This ensures new sessions get created on next request since closed sessions cannot be re-used. Note that this is currently only used by the VS Code extension. I tested it locally, but final testing will happen as part of the PR that updates DH packages to use this change.
1 parent 4b1c9dd commit 7a2e07f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/jsapi-nodejs/src/NodeHttp2gRPCTransport.ts

+7
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,16 @@ export class NodeHttp2gRPCTransport implements GrpcTransport {
5656

5757
if (!NodeHttp2gRPCTransport.sessionMap.has(origin)) {
5858
const session = http2.connect(origin);
59+
5960
session.on('error', err => {
6061
NodeHttp2gRPCTransport.logMessage('error', 'Session error', err);
6162
});
63+
64+
session.on('close', () => {
65+
NodeHttp2gRPCTransport.logMessage('debug', 'Session closed');
66+
NodeHttp2gRPCTransport.sessionMap.delete(origin);
67+
});
68+
6269
NodeHttp2gRPCTransport.sessionMap.set(origin, session);
6370
}
6471

0 commit comments

Comments
 (0)