Skip to content

Commit

Permalink
RetryConfig and TimeoutConfig in file_store (#911)
Browse files Browse the repository at this point in the history
* Add optional timeout_config to FileStore::new

* Add optional retry_config to FileStore::new
  • Loading branch information
kurotych authored Dec 13, 2024
1 parent c25d18b commit aa58a79
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion file_store/src/file_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -63,6 +63,8 @@ impl FileStore {
bucket: String,
endpoint: Option<String>,
region: Option<String>,
timeout_config: Option<TimeoutConfig>,
retry_config: Option<RetryConfig>,
) -> Result<Self> {
let endpoint: Option<Endpoint> = match &endpoint {
Some(endpoint) => Uri::from_str(endpoint)
Expand All @@ -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);
Expand Down

0 comments on commit aa58a79

Please sign in to comment.