Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-period intervals in throttling #1373

Merged
merged 1 commit into from
Dec 29, 2024

Conversation

robhudson
Copy link
Contributor

This pull request enhances the throttling functionality to support multi-period intervals, such as 5/30s, 10/5m, and 100/2h. Previously, the throttling implementation only allowed single-period intervals (e.g., 5/s, 100/d), which limited the granularity and flexibility of rate limits.

The new implementation expands the allowed syntax for throttle rates to accommodate use cases requiring multi-unit periods, making it easier to define more precise rate limits.

Motivation

While single-period intervals work for many scenarios, they lack flexibility for more complex use cases. For example:

  • Higher granularity: A rate like 20/5m (20 requests every 5 minutes) cannot be expressed with the current system.
  • Short-term bursts: Rates like 50/2h allow finer control over bursts without spanning a full day.

@vitalik vitalik merged commit 7ab86e7 into vitalik:master Dec 29, 2024
35 of 37 checks passed
@vitalik
Copy link
Owner

vitalik commented Dec 29, 2024

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants