feat(utils): add rate limiter with token bucket algorithm#132
feat(utils): add rate limiter with token bucket algorithm#132shivv23 wants to merge 1 commit intoc2siorg:mainfrom
Conversation
Sandipmandal25
left a comment
There was a problem hiding this comment.
same here too the file added in this pr is not declared as a module anywhere in the crate so it is never compiled it is dead code
| use std::sync::Arc; | ||
| use std::time::{Duration, Instant}; | ||
|
|
||
| use tokio::sync::Mutex; | ||
|
|
||
| use crate::errors::CloudError; | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub struct RateLimiter { | ||
| inner: Arc<Mutex<RateLimiterInner>>, | ||
| } | ||
|
|
There was a problem hiding this comment.
same here too the file added in this pr is not declared as a module anywhere in the crate so it is never compiled it is dead code and has no effect on the library. There are also no CI checks running on this branch so compilation errors would not be caught automatically but you should verify this before opening one more new pr reporting this again . Beyond the wiring issue there is at least one code level bug in this PR that would prevent compilation. Please run cargo build locally and confirm it compiles before marking this ready for review.
3dec065 to
fd5edcc
Compare
Summary
Add rate limiter using token bucket algorithm.
Why
Cloud providers have rate limits. This prevents hitting them.
What
acquire()- blocks until allowedtry_acquire()- non-blocking checkUsage
Files
rustcloud/src/utils/rate_limiter.rs