Skip to content

Commit

Permalink
fix rate limiting (#5135)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren authored Nov 19, 2024
1 parent 302e41d commit 018080a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion openhands/server/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

app.add_middleware(NoCacheMiddleware)
app.add_middleware(
RateLimitMiddleware, rate_limiter=InMemoryRateLimiter(requests=2, seconds=1)
RateLimitMiddleware, rate_limiter=InMemoryRateLimiter(requests=10, seconds=1)
)


Expand Down
1 change: 1 addition & 0 deletions openhands/server/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class InMemoryRateLimiter:
def __init__(self, requests: int = 2, seconds: int = 1, sleep_seconds: int = 1):
self.requests = requests
self.seconds = seconds
self.sleep_seconds = sleep_seconds
self.history = defaultdict(list)

def _clean_old_requests(self, key: str) -> None:
Expand Down

0 comments on commit 018080a

Please sign in to comment.