diff --git a/src/core/ratelimiter.rs b/src/core/ratelimiter.rs index e8f73a7..c2526c1 100644 --- a/src/core/ratelimiter.rs +++ b/src/core/ratelimiter.rs @@ -25,40 +25,6 @@ impl RateLimiter { } } -// pub fn check_limiter(&mut self) -> LimiterResp { - -// if self.timer.elapsed().as_secs() >= TIME_THRESHOLD_S { -// // # [x] elapsed >= TIME_THRESHOLD_S -// self.timer = Instant::now(); -// self.msgcounter = 0; -// LimiterResp::Allow -// } else if self.msgcounter < MSG_THRESHOLD { -// // # [x] elapsed < TIME_THRESHOLD_S && msgcounter < MSG_THRESHOLD -// LimiterResp::Allow -// // } else if self.msgcounter >= MSG_THRESHOLD { -// } else { -// // # [x] elapsed < TIME_THRESHOLD_S && msgcounter >= MSG_THRESHOLD -// LimiterResp::Skip -// } -// } - -// pub fn check_limiter(&self) -> LimiterResp { - -// if self.timer.elapsed().as_secs() >= TIME_THRESHOLD_S { -// // # [x] elapsed >= TIME_THRESHOLD_S -// self.timer = Instant::now(); -// self.msgcounter = 0; -// LimiterResp::Allow -// } else if self.msgcounter < MSG_THRESHOLD { -// // # [x] elapsed < TIME_THRESHOLD_S && msgcounter < MSG_THRESHOLD -// LimiterResp::Allow -// // } else if self.msgcounter >= MSG_THRESHOLD { -// } else { -// // # [x] elapsed < TIME_THRESHOLD_S && msgcounter >= MSG_THRESHOLD -// LimiterResp::Skip -// } -// } - pub fn check_limiter(&mut self) -> LimiterResp { if self.timer.elapsed().as_secs() >= TIME_THRESHOLD_S { @@ -76,10 +42,6 @@ pub fn check_limiter(&mut self) -> LimiterResp { } } - // pub fn increment_counter(&mut self) -> () { - // self.msgcounter += 1; - // } - pub fn increment_counter(&mut self) -> () { self.msgcounter += 1; }