From 97e62d77b2accf78c08d33060accf17b9fdf7f06 Mon Sep 17 00:00:00 2001 From: Radovan Zvoncek Date: Thu, 16 May 2024 12:48:01 +0300 Subject: [PATCH] Make read timeout configurable --- medusa-example.ini | 3 +++ medusa/config.py | 5 +++-- medusa/storage/s3_base_storage.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/medusa-example.ini b/medusa-example.ini index f57182f6..235e5634 100644 --- a/medusa-example.ini +++ b/medusa-example.ini @@ -118,6 +118,9 @@ use_sudo_for_restore = True ;aws_cli_path = +; Read timeout in seconds for the storage provider. +;read_timeout = 60 + [monitoring] ;monitoring_provider = diff --git a/medusa/config.py b/medusa/config.py index b7f55d30..3e133cf0 100644 --- a/medusa/config.py +++ b/medusa/config.py @@ -31,7 +31,7 @@ ['bucket_name', 'key_file', 'prefix', 'fqdn', 'host_file_separator', 'storage_provider', 'base_path', 'max_backup_age', 'max_backup_count', 'api_profile', 'transfer_max_bandwidth', 'concurrent_transfers', 'multi_part_upload_threshold', 'host', 'region', 'port', 'secure', 'ssl_verify', - 'aws_cli_path', 'kms_id', 'backup_grace_period_in_days', 'use_sudo_for_restore', 'k8s_mode'] + 'aws_cli_path', 'kms_id', 'backup_grace_period_in_days', 'use_sudo_for_restore', 'k8s_mode', 'read_timeout'] ) CassandraConfig = collections.namedtuple( @@ -116,7 +116,8 @@ def _build_default_config(): 'fqdn': socket.getfqdn(), 'region': 'default', 'backup_grace_period_in_days': 10, - 'use_sudo_for_restore': 'True' + 'use_sudo_for_restore': 'True', + 'read_timeout': 60 } config['logging'] = { diff --git a/medusa/storage/s3_base_storage.py b/medusa/storage/s3_base_storage.py index 2c250f85..9ae042f6 100644 --- a/medusa/storage/s3_base_storage.py +++ b/medusa/storage/s3_base_storage.py @@ -136,7 +136,8 @@ def connect(self): region_name=self.credentials.region, signature_version='v4', tcp_keepalive=True, - max_pool_connections=max_pool_size + max_pool_connections=max_pool_size, + read_timeout=self.config.read_timeout, ) if self.credentials.access_key_id is not None: self.s3_client = boto3.client(