Skip to content

Commit

Permalink
feat(search): Adds ratelimiter to throttle csv exports per day
Browse files Browse the repository at this point in the history
  • Loading branch information
ERosendo committed Jan 6, 2025
1 parent f6bc9e1 commit 725a2e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cl/lib/ratelimiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def get_path_to_make_key(group: str, request: HttpRequest) -> str:
if "test" in sys.argv:
ratelimiter_all_2_per_m = lambda func: func
ratelimiter_unsafe_3_per_m = lambda func: func
ratelimiter_unsafe_5_per_d = lambda func: func
ratelimiter_unsafe_10_per_m = lambda func: func
ratelimiter_all_10_per_h = lambda func: func
ratelimiter_unsafe_2000_per_h = lambda func: func
Expand All @@ -79,6 +80,11 @@ def get_path_to_make_key(group: str, request: HttpRequest) -> str:
rate="3/m",
method=UNSAFE,
)
ratelimiter_unsafe_5_per_d = ratelimit(
key=get_ip_for_ratelimiter,
rate="5/d",
method=UNSAFE,
)
ratelimiter_unsafe_10_per_m = ratelimit(
key=get_ip_for_ratelimiter,
rate="10/m",
Expand Down

0 comments on commit 725a2e9

Please sign in to comment.