fix(rate-limit): apply on router to avoid TypeError on ws endpoint
This commit is contained in:
14
app/dependencies/rate_limit.py
Normal file
14
app/dependencies/rate_limit.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.config import settings
|
||||
|
||||
from fastapi import Depends
|
||||
from fastapi_limiter.depends import RateLimiter
|
||||
|
||||
if settings.enable_rate_limit:
|
||||
LIMITERS = [
|
||||
Depends(RateLimiter(times=1200, minutes=1)),
|
||||
Depends(RateLimiter(times=200, seconds=1)),
|
||||
]
|
||||
else:
|
||||
LIMITERS = []
|
||||
Reference in New Issue
Block a user