Skip to content

Commit c9e8267

Browse files
Copilotzubinqayam
andcommitted
Improve comments in rate limiter based on code review feedback
Co-authored-by: zubinqayam <221898115+zubinqayam@users.noreply.github.com>
1 parent c35d0bc commit c9e8267

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ratelimit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ async def wrapper(*args, **kwargs):
2525
if req is None:
2626
req = kwargs.get("request", None)
2727

28-
# If no request found, just call the function
28+
# If no request found (e.g., in tests or direct function calls), execute without rate limiting
2929
if req is None:
3030
if inspect.iscoroutinefunction(func):
3131
return await func(*args, **kwargs)
3232
else:
3333
return func(*args, **kwargs)
3434

35-
# Rate limiting logic
35+
# Apply rate limiting: check window, count requests, and enforce limits
3636
now = time.time()
3737
k = _key(req)
3838
window_start, count = _STORE.get(k, (now, 0))

0 commit comments

Comments
 (0)