Skip to content

Commit

Permalink
[object store] Disable more timeouts (#19486)
Browse files Browse the repository at this point in the history
  • Loading branch information
williampsmith authored Sep 23, 2024
1 parent 7c9b1d1 commit 0caf315
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 12 additions & 6 deletions crates/sui-config/src/object_storage_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ fn default_object_store_connection_limit() -> usize {
20
}

fn no_timeout_options() -> ClientOptions {
ClientOptions::new()
.with_timeout_disabled()
.with_connect_timeout_disabled()
.with_pool_idle_timeout(std::time::Duration::from_secs(300))
}

impl ObjectStoreConfig {
fn new_local_fs(&self) -> Result<Arc<DynObjectStore>, anyhow::Error> {
info!(directory=?self.directory, object_store_type="File", "Object Store");
Expand All @@ -125,7 +132,9 @@ impl ObjectStoreConfig {

info!(bucket=?self.bucket, object_store_type="S3", "Object Store");

let mut builder = AmazonS3Builder::new().with_imdsv1_fallback();
let mut builder = AmazonS3Builder::new()
.with_client_options(no_timeout_options())
.with_imdsv1_fallback();

if self.aws_virtual_hosted_style_request {
builder = builder.with_virtual_hosted_style_request(true);
Expand Down Expand Up @@ -183,10 +192,7 @@ impl ObjectStoreConfig {
builder = builder.with_service_account_path(account);
}

let mut client_options = ClientOptions::new()
.with_timeout_disabled()
.with_connect_timeout_disabled()
.with_pool_idle_timeout(std::time::Duration::from_secs(300));
let mut client_options = no_timeout_options();
if let Some(google_project_id) = &self.google_project_id {
let x_project_header = HeaderName::from_static("x-goog-user-project");
let iam_req_header = HeaderName::from_static("userproject");
Expand All @@ -210,7 +216,7 @@ impl ObjectStoreConfig {
info!(bucket=?self.bucket, account=?self.azure_storage_account,
object_store_type="Azure", "Object Store");

let mut builder = MicrosoftAzureBuilder::new();
let mut builder = MicrosoftAzureBuilder::new().with_client_options(no_timeout_options());

if let Some(bucket) = &self.bucket {
builder = builder.with_container_name(bucket);
Expand Down
4 changes: 3 additions & 1 deletion crates/sui-storage/src/object_store/http/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pub(crate) struct S3Client {
impl S3Client {
pub fn new(endpoint: &str) -> Result<Self> {
let mut builder = ClientBuilder::new();
builder = builder.user_agent(DEFAULT_USER_AGENT);
builder = builder
.user_agent(DEFAULT_USER_AGENT)
.pool_idle_timeout(None);
let client = builder.https_only(false).build()?;

Ok(Self {
Expand Down

0 comments on commit 0caf315

Please sign in to comment.