From bf78e4e1cbbddb72d51a79849ff3559b774c201a Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Thu, 26 Oct 2023 09:39:00 +0300 Subject: [PATCH] Add two new grpc config values: max_send_message_length and max_receive_message_length --- medusa/config.py | 4 +++- medusa/service/grpc/server.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/medusa/config.py b/medusa/config.py index 79fcb9c17..6d5f425cf 100644 --- a/medusa/config.py +++ b/medusa/config.py @@ -73,7 +73,7 @@ GrpcConfig = collections.namedtuple( 'GrpcConfig', - ['enabled'] + ['enabled', 'max_send_message_length', 'max_receive_message_length'] ) KubernetesConfig = collections.namedtuple( @@ -161,6 +161,8 @@ def _build_default_config(): config['grpc'] = { 'enabled': 'False', + 'max_send_message_length': '536870912', + 'max_receive_message_length': '134217728', } config['kubernetes'] = { diff --git a/medusa/service/grpc/server.py b/medusa/service/grpc/server.py index 08024695e..58fecbbb8 100644 --- a/medusa/service/grpc/server.py +++ b/medusa/service/grpc/server.py @@ -52,7 +52,10 @@ def __init__(self, config_file_path, testing=False): self.config_file_path = config_file_path self.medusa_config = self.create_config() self.testing = testing - self.grpc_server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) + self.grpc_server = grpc.server(futures.ThreadPoolExecutor(max_workers=10), options = [ + ('grpc.max_send_message_length', self.medusa_config.grpc.max_send_message_length), + ('grpc.max_receive_message_length', self.medusa_config.grpc.max_receive_message_length) + ]) logging.info("GRPC server initialized") def shutdown(self, signum, frame):