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

fix: speed up cloud linter command #306

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ client-cli.iml
bin/
momento.exe
obj/
*.gz

19 changes: 13 additions & 6 deletions momento/src/commands/cloud_linter/linter_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,24 @@ pub async fn run_cloud_linter(region: String) -> Result<(), CliError> {
let output_file_path = "linter_results.json.gz";
check_output_is_writable(output_file_path).await?;

let quota =
Quota::per_second(core::num::NonZeroU32::new(1).expect("should create non-zero quota"));
let limiter = Arc::new(RateLimiter::direct(quota));
let fast_quota = Quota::per_second(
core::num::NonZeroU32::new(10).expect("should create non-zero fast_quota"),
);
let fast_limiter = Arc::new(RateLimiter::direct(fast_quota));

let mut resources = get_ddb_resources(&config, Arc::clone(&limiter)).await?;
let slow_quota = Quota::per_second(
core::num::NonZeroU32::new(1).expect("should create non-zero slow_quota"),
);
let slow_limiter = Arc::new(RateLimiter::direct(slow_quota));

let mut resources = get_ddb_resources(&config, Arc::clone(&slow_limiter)).await?;

let mut elasticache_resources =
get_elasticache_resources(&config, Arc::clone(&limiter)).await?;
get_elasticache_resources(&config, Arc::clone(&fast_limiter)).await?;
resources.append(&mut elasticache_resources);

let resources = append_metrics_to_resources(&config, Arc::clone(&limiter), resources).await?;
let resources =
append_metrics_to_resources(&config, Arc::clone(&fast_limiter), resources).await?;

let data_format = DataFormat { resources };

Expand Down
Loading