Merge pull request #1666 from dwrip/master

feature(grpc-js): Add possibility to provide maxSessionMemory http2 option through ChannelOptions
This commit is contained in:
Michael Lumish 2021-04-02 11:09:57 -07:00 committed by GitHub
commit c3aeb94b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -36,6 +36,7 @@ export interface ChannelOptions {
'grpc.enable_http_proxy'?: number;
'grpc.http_connect_target'?: string;
'grpc.http_connect_creds'?: string;
'grpc-node.max_session_memory'?: number;
[key: string]: any;
}
@ -59,6 +60,7 @@ export const recognizedOptions = {
'grpc.max_send_message_length': true,
'grpc.max_receive_message_length': true,
'grpc.enable_http_proxy': true,
'grpc-node.max_session_memory': true,
};
export function channelOptionsEqual(

View File

@ -260,6 +260,9 @@ export class Server {
const serverOptions: http2.ServerOptions = {
maxSendHeaderBlockLength: Number.MAX_SAFE_INTEGER
};
if ('grpc-node.max_session_memory' in this.options) {
serverOptions.maxSessionMemory = this.options['grpc-node.max_session_memory'];
}
if ('grpc.max_concurrent_streams' in this.options) {
serverOptions.settings = {
maxConcurrentStreams: this.options['grpc.max_concurrent_streams'],

View File

@ -307,6 +307,9 @@ export class Subchannel {
let connectionOptions: http2.SecureClientSessionOptions =
this.credentials._getConnectionOptions() || {};
connectionOptions.maxSendHeaderBlockLength = Number.MAX_SAFE_INTEGER;
if ('grpc-node.max_session_memory' in this.options) {
connectionOptions.maxSessionMemory = this.options['grpc-node.max_session_memory'];
}
let addressScheme = 'http://';
if ('secureContext' in connectionOptions) {
addressScheme = 'https://';