envoyproxy / ratelimit

Go/gRPC service designed to enable generic rate limit scenarios from different types of applications.
Apache License 2.0
2.3k stars 453 forks source link

Feature Request: Update limit_remaining Immediately When current_limit Changes #744

Open ghouse97 opened 1 month ago

ghouse97 commented 1 month ago

When the current_limit is updated, we can see the new current_limit value in the response. However, the limit_remaining value is not updated immediately to reflect this change. Instead, it remains unchanged and only gets updated after the reset of the current window.

Problem: For example, let's say we have a rate limit window from 10:00 AM to 11:00 AM with an initial current_limit of 10,000 requests per hour. If the limit_remaining reaches 0 by 10:15 AM and we subsequently increase the current_limit to 15,000, we can see the updated current_limit in the response. However, the limit_remaining value remains 0 until the window resets at 11:00 AM. This behavior doesn't reflect the updated limit in real time, which could be misleading.

Proposed Solution: It would be more intuitive and useful if the limit_remaining value were updated immediately when the current_limit changes. In the example above, after increasing the current_limit to 15,000, the limit_remaining should update to 5,000, reflecting the available requests left in the current window.

This change would ensure that the response data remains consistent and accurately represents the state of the rate limit at any given time.

superaghu commented 1 month ago

Can this be prioritized, as we are also seeing this same issue.

github-actions[bot] commented 4 days ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.