Skip to content

Commit

Permalink
fix: only print ratelimit details if % UPPER_LIMIT
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackwills committed Apr 12, 2024
1 parent 838f9a9 commit 8d51bbe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/db_redis/ratelimit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ impl RateLimit {
if let Some(count) = redis.get::<Option<u64>, &str>(&self.key).await? {
redis.incr(&self.key).await?;
if count >= UPPER_LIMIT {
tracing::info!("{} - {count}", self.key);
// Only show the count if is multiple of the upper limit
if count % UPPER_LIMIT == 0 {
tracing::info!("{} - {count}", self.key);
}
redis.expire(&self.key, ONE_MINUTE * 5).await?;
}
if count > LOWER_LIMIT {
Expand Down

0 comments on commit 8d51bbe

Please sign in to comment.