Skip to content

Commit 3ccf7f2

Browse files
committed
feat: run batcher with only one storage if second config is not set
1 parent 4b53811 commit 3ccf7f2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

crates/batcher/src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ impl Batcher {
129129
let s3_bucket_name_secondary = env::var("AWS_BUCKET_NAME_SECONDARY").ok();
130130
let download_endpoint_secondary = env::var("DOWNLOAD_ENDPOINT_SECONDARY").ok();
131131

132-
let s3_client_secondary = if s3_bucket_name_secondary.is_some() && download_endpoint_secondary.is_some() {
132+
let s3_client_secondary = if s3_bucket_name_secondary.is_some()
133+
&& download_endpoint_secondary.is_some()
134+
{
133135
let s3_config_secondary = s3::S3Config {
134136
access_key_id: env::var("AWS_ACCESS_KEY_ID_SECONDARY").ok(),
135137
secret_access_key: env::var("AWS_SECRET_ACCESS_KEY_SECONDARY").ok(),
@@ -1916,8 +1918,15 @@ impl Batcher {
19161918
}
19171919

19181920
// Try secondary S3 upload (if configured)
1919-
if let (Some(s3_client_secondary), Some(s3_bucket_name_secondary), Some(download_endpoint_secondary)) =
1920-
(&self.s3_client_secondary, &self.s3_bucket_name_secondary, &self.download_endpoint_secondary) {
1921+
if let (
1922+
Some(s3_client_secondary),
1923+
Some(s3_bucket_name_secondary),
1924+
Some(download_endpoint_secondary),
1925+
) = (
1926+
&self.s3_client_secondary,
1927+
&self.s3_bucket_name_secondary,
1928+
&self.download_endpoint_secondary,
1929+
) {
19211930
if self
19221931
.upload_batch_to_s3(
19231932
s3_client_secondary,

0 commit comments

Comments
 (0)