Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RetryConfig and TimeoutConfig in file_store #911

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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