Skip to content

Commit 07486d8

Browse files
authored
Merge pull request #2937 from murgatroid99/grpc-js_avoid_getDefaultSettings
grpc-js: Avoid calling http2.getDefaultSettings
2 parents 6f916c9 + 482006e commit 07486d8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/grpc-js/src/transport.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -695,16 +695,17 @@ export class Http2SubchannelConnector implements SubchannelConnector {
695695
reject(`${errorMessage} (${new Date().toISOString()})`);
696696
}
697697
};
698-
const session = http2.connect(`${scheme}://${targetPath}`, {
698+
const sessionOptions: http2.ClientSessionOptions = {
699699
createConnection: (authority, option) => {
700700
return secureConnectResult.socket;
701-
},
702-
settings: {
703-
initialWindowSize:
704-
options['grpc-node.flow_control_window'] ??
705-
http2.getDefaultSettings().initialWindowSize,
706701
}
707-
});
702+
};
703+
if (options['grpc-node.flow_control_window'] !== undefined) {
704+
sessionOptions.settings = {
705+
initialWindowSize: options['grpc-node.flow_control_window']
706+
};
707+
}
708+
const session = http2.connect(`${scheme}://${targetPath}`, sessionOptions);
708709
this.session = session;
709710
let errorMessage = 'Failed to connect';
710711
let reportedError = false;

0 commit comments

Comments
 (0)