From aa58a79964abd89fbdd8d460d1847667bca11034 Mon Sep 17 00:00:00 2001 From: Anatolii Kurotych Date: Fri, 13 Dec 2024 11:16:00 +0200 Subject: [PATCH] RetryConfig and TimeoutConfig in file_store (#911) * Add optional timeout_config to FileStore::new * Add optional retry_config to FileStore::new --- file_store/src/file_store.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/file_store/src/file_store.rs b/file_store/src/file_store.rs index abecd1269..3ed43ada1 100644 --- a/file_store/src/file_store.rs +++ b/file_store/src/file_store.rs @@ -3,7 +3,7 @@ use crate::{ settings::{self, Settings}, BytesMutStream, Error, FileInfo, FileInfoStream, Result, }; -use aws_config::meta::region::RegionProviderChain; +use aws_config::{meta::region::RegionProviderChain, retry::RetryConfig, timeout::TimeoutConfig}; use aws_sdk_s3::{types::ByteStream, Client, Endpoint, Region}; use chrono::{DateTime, Utc}; use futures::FutureExt; @@ -63,6 +63,8 @@ impl FileStore { bucket: String, endpoint: Option, region: Option, + timeout_config: Option, + retry_config: Option, ) -> Result { let endpoint: Option = match &endpoint { Some(endpoint) => Uri::from_str(endpoint) @@ -79,6 +81,14 @@ impl FileStore { config = config.endpoint_resolver(endpoint); } + if let Some(timeout) = timeout_config { + config = config.timeout_config(timeout); + } + + if let Some(retry) = retry_config { + config = config.retry_config(retry); + } + let config = config.load().await; let client = Client::new(&config);