You've already forked AstralRinth
forked from didirus/AstralRinth
chore(clippy): enable and fix many stricter lints (#3783)
* chore(clippy): enable and fix many stricter lints These ensure that the codebase uses more idiomatic, performant, and concise language constructions. * chore: make non-Clippy compiler warnings also deny by default
This commit is contained in:
committed by
GitHub
parent
301967d204
commit
f84f8c1c2b
@@ -56,18 +56,15 @@ impl AsyncRateLimiter {
|
||||
}
|
||||
|
||||
pub async fn check_rate_limit(&self, key: &str) -> RateLimitDecision {
|
||||
let mut conn = match self.redis_pool.connect().await {
|
||||
Ok(conn) => conn,
|
||||
Err(_) => {
|
||||
// If Redis is unavailable, allow the request but with reduced limit
|
||||
return RateLimitDecision {
|
||||
allowed: true,
|
||||
limit: self.params.burst_size,
|
||||
remaining: 1,
|
||||
reset_after_ms: 60_000, // 1 minute
|
||||
retry_after_ms: None,
|
||||
};
|
||||
}
|
||||
let Ok(mut conn) = self.redis_pool.connect().await else {
|
||||
// If Redis is unavailable, allow the request but with reduced limit
|
||||
return RateLimitDecision {
|
||||
allowed: true,
|
||||
limit: self.params.burst_size,
|
||||
remaining: 1,
|
||||
reset_after_ms: 60_000, // 1 minute
|
||||
retry_after_ms: None,
|
||||
};
|
||||
};
|
||||
|
||||
// Get current time in nanoseconds since UNIX epoch
|
||||
|
||||
Reference in New Issue
Block a user