Skip to content

Commit

Permalink
Merge pull request #536 from tursodatabase/bottomless-retry
Browse files Browse the repository at this point in the history
Make s3 retry op configurable and set default to 10
  • Loading branch information
psarna committed Oct 31, 2023
2 parents a8a8cfd + 3aa0955 commit ba65f36
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bottomless/src/replicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ pub struct Options {
/// When recovering a transaction, when its page cache needs to be swapped onto local file,
/// this field contains a path for a file to be used.
pub restore_transaction_cache_fpath: String,
/// Max number of retries for S3 operations
pub s3_max_retries: u32,
}

impl Options {
Expand Down Expand Up @@ -142,7 +144,10 @@ impl Options {
None,
"Static",
))
.retry_config(aws_sdk_s3::config::retry::RetryConfig::standard().with_max_attempts(6))
.retry_config(
aws_sdk_s3::config::retry::RetryConfig::standard()
.with_max_attempts(self.s3_max_retries),
)
.build();
Ok(conf)
}
Expand Down Expand Up @@ -192,6 +197,7 @@ impl Options {
other
),
};
let s3_max_retries = env_var_or("LIBSQL_BOTTOMLESS_S3_MAX_RETRIES", 10).parse::<u32>()?;
Ok(Options {
db_id,
create_bucket_if_not_exists: true,
Expand All @@ -207,6 +213,7 @@ impl Options {
region,
restore_transaction_cache_fpath,
bucket_name,
s3_max_retries,
})
}
}
Expand Down

0 comments on commit ba65f36

Please sign in to comment.