Skip to content

Commit

Permalink
benchmark: rate limiter overheads
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Dec 26, 2024
1 parent 0881b1a commit a4c6bd7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions caffeine/microbenchmarks/bench_web_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ def bench_list_view_query():
assert resp.status_code == 200


from frappe import rate_limiter


def bench_rate_limiter():
"""Simulate everything that rate limiter typically does."""
frappe.conf.rate_limit = {"limit": 28800000, "window": 86400}
rate_limiter.apply()
rate_limiter.update()
frappe.local.rate_limiter.headers()


@lru_cache
def get_site():
return frappe.local.site
Expand Down

0 comments on commit a4c6bd7

Please sign in to comment.