Skip to content

Commit 11d93cd

Browse files
miketyJoeHowarth
authored andcommitted
Add defaults for AwsCliArgs
1 parent 33d321a commit 11d93cd

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

monad-archive/src/bin/monad-archive-checker/model.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ impl CheckerModel {
101101

102102
// Get the list of replicas from S3
103103
let mut replica_args = Self::get_replica_args(s3).await?;
104+
info!("Loaded replicas from s3: {:?}", replica_args);
104105

105106
// Initialize replica args bucket
106107
// Handle errors cases

monad-archive/src/cli.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ use serde::{Deserialize, Serialize};
2626
use crate::{kvstore::mongo::MongoDbStorage, prelude::*};
2727

2828
const DEFAULT_BUCKET_TIMEOUT: u64 = 10;
29+
const DEFAULT_CONCURRENCY: usize = 50;
30+
31+
pub fn get_default_bucket_timeout() -> u64 {
32+
DEFAULT_BUCKET_TIMEOUT
33+
}
2934

3035
pub fn set_source_and_sink_metrics(
3136
sink: &ArchiveArgs,
@@ -282,8 +287,11 @@ pub struct AwsCliArgs {
282287
// TODO: remove me, concurrency should be handled elsewhere
283288
pub concurrency: usize,
284289
// If these are not provided, uses timeout_secs for all
290+
#[serde(default = "get_default_bucket_timeout")]
285291
pub operation_timeout_secs: u64,
292+
#[serde(default = "get_default_bucket_timeout")]
286293
pub operation_attempt_timeout_secs: u64,
294+
#[serde(default = "get_default_bucket_timeout")]
287295
pub read_timeout_secs: u64,
288296
}
289297

@@ -315,7 +323,7 @@ impl AwsCliArgs {
315323
.remove("concurrency")
316324
.and_then(|s| usize::from_str(&s).ok())
317325
// TODO: remove me, concurrency should be handled elsewhere
318-
.unwrap_or(200),
326+
.unwrap_or(DEFAULT_CONCURRENCY),
319327
// If these are not provided, uses timeout_secs for all
320328
operation_timeout_secs: get_u64(&kv, "operation-timeout-secs", timeout_secs),
321329
operation_attempt_timeout_secs: get_u64(
@@ -519,7 +527,7 @@ mod tests {
519527
match a {
520528
BlockDataReaderArgs::Aws(args) => {
521529
assert_eq!(args.bucket, "my-bucket");
522-
assert_eq!(args.concurrency, 200); // default
530+
assert_eq!(args.concurrency, DEFAULT_CONCURRENCY); // default
523531
assert_eq!(args.region, None);
524532
}
525533
_ => panic!("expected Aws variant"),
@@ -543,7 +551,7 @@ mod tests {
543551
match a {
544552
BlockDataReaderArgs::Aws(args) => {
545553
assert_eq!(args.bucket, "my-bucket");
546-
assert_eq!(args.concurrency, 200);
554+
assert_eq!(args.concurrency, DEFAULT_CONCURRENCY);
547555
assert_eq!(args.region.as_deref(), None);
548556
}
549557
_ => panic!("expected Aws variant"),

0 commit comments

Comments
 (0)