fix: define grpc max message size
This commit is contained in:
parent
aa4351c8e9
commit
bfef16ce37
3 changed files with 21 additions and 0 deletions
|
@ -160,6 +160,11 @@ export class ContainerConfigLoader {
|
|||
const grpcAgentKeepAliveTimeout = env.get('GRPC_AGENT_KEEP_ALIVE_TIMEOUT', true)
|
||||
? +env.get('GRPC_AGENT_KEEP_ALIVE_TIMEOUT', true)
|
||||
: 8_000
|
||||
|
||||
const grpcMaxMessageSize = env.get('GRPC_MAX_MESSAGE_SIZE', true)
|
||||
? +env.get('GRPC_MAX_MESSAGE_SIZE', true)
|
||||
: 1024 * 1024 * 50
|
||||
|
||||
container.bind<ISessionsClient>(TYPES.ApiGateway_GRPCSessionsClient).toConstantValue(
|
||||
new SessionsClient(
|
||||
container.get<string>(TYPES.ApiGateway_AUTH_SERVER_GRPC_URL),
|
||||
|
@ -169,6 +174,8 @@ export class ContainerConfigLoader {
|
|||
'grpc.keepalive_timeout_ms': grpcAgentKeepAliveTimeout,
|
||||
'grpc.default_compression_algorithm': grpc.compressionAlgorithms.gzip,
|
||||
'grpc.default_compression_level': 2,
|
||||
'grpc.max_receive_message_length': grpcMaxMessageSize,
|
||||
'grpc.max_send_message_length': grpcMaxMessageSize,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
@ -181,6 +188,8 @@ export class ContainerConfigLoader {
|
|||
'grpc.keepalive_timeout_ms': grpcAgentKeepAliveTimeout,
|
||||
'grpc.default_compression_algorithm': grpc.compressionAlgorithms.gzip,
|
||||
'grpc.default_compression_level': 2,
|
||||
'grpc.max_receive_message_length': grpcMaxMessageSize,
|
||||
'grpc.max_send_message_length': grpcMaxMessageSize,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -81,10 +81,16 @@ void container.load().then((container) => {
|
|||
? +env.get('GRPC_KEEP_ALIVE_TIMEOUT', true)
|
||||
: 10_000
|
||||
|
||||
const grpcMaxMessageSize = env.get('GRPC_MAX_MESSAGE_SIZE', true)
|
||||
? +env.get('GRPC_MAX_MESSAGE_SIZE', true)
|
||||
: 1024 * 1024 * 50
|
||||
|
||||
const grpcServer = new grpc.Server({
|
||||
'grpc.keepalive_time_ms': grpcKeepAliveTimeout * 2,
|
||||
'grpc.keepalive_timeout_ms': grpcKeepAliveTimeout,
|
||||
'grpc.default_compression_algorithm': grpc.compressionAlgorithms.gzip,
|
||||
'grpc.max_receive_message_length': grpcMaxMessageSize,
|
||||
'grpc.max_send_message_length': grpcMaxMessageSize,
|
||||
})
|
||||
|
||||
const gRPCPort = env.get('GRPC_PORT', true) ? +env.get('GRPC_PORT', true) : 50051
|
||||
|
|
|
@ -89,10 +89,16 @@ void container.load().then((container) => {
|
|||
? +env.get('GRPC_KEEP_ALIVE_TIMEOUT', true)
|
||||
: 10_000
|
||||
|
||||
const grpcMaxMessageSize = env.get('GRPC_MAX_MESSAGE_SIZE', true)
|
||||
? +env.get('GRPC_MAX_MESSAGE_SIZE', true)
|
||||
: 1024 * 1024 * 50
|
||||
|
||||
const grpcServer = new grpc.Server({
|
||||
'grpc.keepalive_time_ms': grpcKeepAliveTimeout * 2,
|
||||
'grpc.keepalive_timeout_ms': grpcKeepAliveTimeout,
|
||||
'grpc.default_compression_algorithm': grpc.compressionAlgorithms.gzip,
|
||||
'grpc.max_receive_message_length': grpcMaxMessageSize,
|
||||
'grpc.max_send_message_length': grpcMaxMessageSize,
|
||||
})
|
||||
|
||||
const gRPCPort = env.get('GRPC_PORT', true) ? +env.get('GRPC_PORT', true) : 50051
|
||||
|
|
Loading…
Reference in a new issue