Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Dec 19, 2024
1 parent 2c32784 commit 7870c30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ee/tabby-webserver/src/rate_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl UserRateLimiter {
pub async fn is_allowed(&self, uri: &axum::http::Uri, user_id: &str) -> bool {
// Do not limit health check requests.
if uri.path().ends_with("/v1/health") || uri.path().ends_with("/v1beta/health") {
return true
return true;
}

let mut rate_limiters = self.rate_limiters.lock().await;
Expand Down
6 changes: 5 additions & 1 deletion ee/tabby-webserver/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ impl WorkerService for ServerContext {

if let Some(user) = user {
// Apply rate limiting when `user` is not none.
if !self.user_rate_limiter.is_allowed(request.uri(), &user).await {
if !self
.user_rate_limiter
.is_allowed(request.uri(), &user)
.await

Check warning on line 236 in ee/tabby-webserver/src/service/mod.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/service/mod.rs#L233-L236

Added lines #L233 - L236 were not covered by tests
{
return axum::response::Response::builder()
.status(StatusCode::TOO_MANY_REQUESTS)
.body(Body::empty())
Expand Down

0 comments on commit 7870c30

Please sign in to comment.