fix: allow configurable http2 initial window size. fixes #2429

This commit is contained in:
Ricki Hastings 2024-12-06 11:48:31 +00:00
parent 8f08bbe621
commit d08318d8c1
3 changed files with 8 additions and 0 deletions

View File

@ -70,6 +70,7 @@ Many channel arguments supported in `grpc` are not supported in `@grpc/grpc-js`.
- `grpc-node.max_session_memory`
- `grpc-node.tls_enable_trace`
- `grpc-node.retry_max_attempts_limit`
- `grpc-node.http2_initial_window_size`
- `channelOverride`
- `channelFactoryOverride`

View File

@ -64,6 +64,7 @@ export interface ChannelOptions {
'grpc-node.tls_enable_trace'?: number;
'grpc.lb.ring_hash.ring_size_cap'?: number;
'grpc-node.retry_max_attempts_limit'?: number;
'grpc-node.http2_initial_window_size'?: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
@ -101,6 +102,7 @@ export const recognizedOptions = {
'grpc-node.tls_enable_trace': true,
'grpc.lb.ring_hash.ring_size_cap': true,
'grpc-node.retry_max_attempts_limit': true,
'grpc-node.http2_initial_window_size': true,
};
export function channelOptionsEqual(

View File

@ -672,6 +672,11 @@ export class Http2SubchannelConnector implements SubchannelConnector {
const session = http2.connect(`http://${targetPath}`, {
createConnection: (authority, option) => {
return underlyingConnection;
},
settings: {
initialWindowSize:
options['grpc-node.http2_initial_window_size'] ||
http2.getDefaultSettings().initialWindowSize,
}
});
this.session = session;