Skip to content

Commit 5b0956a

Browse files
authored
Merge pull request #2864 from rickihastings/patch/configurable-http2-initial-window-size
feat(grpc-js): allow configurable http2 initial window size
2 parents 137f476 + c591c2a commit 5b0956a

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

packages/grpc-js/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Many channel arguments supported in `grpc` are not supported in `@grpc/grpc-js`.
7070
- `grpc-node.max_session_memory`
7171
- `grpc-node.tls_enable_trace`
7272
- `grpc-node.retry_max_attempts_limit`
73+
- `grpc-node.flow_control_window`
7374
- `channelOverride`
7475
- `channelFactoryOverride`
7576

packages/grpc-js/src/channel-options.ts

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export interface ChannelOptions {
6464
'grpc-node.tls_enable_trace'?: number;
6565
'grpc.lb.ring_hash.ring_size_cap'?: number;
6666
'grpc-node.retry_max_attempts_limit'?: number;
67+
'grpc-node.flow_control_window'?: number;
6768
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6869
[key: string]: any;
6970
}
@@ -101,6 +102,7 @@ export const recognizedOptions = {
101102
'grpc-node.tls_enable_trace': true,
102103
'grpc.lb.ring_hash.ring_size_cap': true,
103104
'grpc-node.retry_max_attempts_limit': true,
105+
'grpc-node.flow_control_window': true,
104106
};
105107

106108
export function channelOptionsEqual(

packages/grpc-js/src/transport.ts

+5
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,11 @@ export class Http2SubchannelConnector implements SubchannelConnector {
673673
const session = http2.connect(`http://${targetPath}`, {
674674
createConnection: (authority, option) => {
675675
return underlyingConnection;
676+
},
677+
settings: {
678+
initialWindowSize:
679+
options['grpc-node.flow_control_window'] ??
680+
http2.getDefaultSettings().initialWindowSize,
676681
}
677682
});
678683
this.session = session;

0 commit comments

Comments
 (0)