-
Notifications
You must be signed in to change notification settings - Fork 49
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
Know actual rate limit status #45
Comments
What would be the benefit, use case for |
It could be useful to give some details to user before the fails that he already have exceed limit. When user start application, he could know if he already have exceed limit, the next date for new try, etc. And we do not want to try to "limit" since no actions are asked by user. Our use-case: We want to limit the number of email send by an user. And to be user-friendly, we want to display to user his actual rate limit before he perform any action. |
When using First, thank you for the library. I've just used it yesterday and today to write a WordPress/WooCommerce plugin after a DOS attack via our payment processor – someone ran ~1200 fake cards into our checkout and our payment processor said "that's enough processing for today", cutting off our legitimate customers. What I've built is: BH WC Checkout Rate Limiter where the main code using the rate limiting is in the AJAX class (i.e. when someone clicks "Place Order"). What I'm able to do with the returned Status class, I feel could be richer. In this case, I'd like to use Adding Aside, for my usage of the library, I wanted to use it in WordPress, so I found a library that implemented WordPress's transient cache (thus object cache) in PSR-16, then wrote a PSR-16 layer. The WordPress implementation then was just a constructor feeding wp-oop/transient-cache. Please take a look and let me know have I missed anything, if not I'll make a PR: Psr16RateLimiter.php |
Thank you very much @BrianHenryIE 👍🏻
@jeremiegrenier Would something like this meet your needs as well?
This seems promising, PSR-16 rate limit back-end could be an interesting idea. I'll be happy to consider and review a PR for that. |
Hi,
Currently you can't get the actual rate limit status. Indeed, you only have the status after call to
limit
orlimitSilently
.I think it could be great to have a method like
getRateLimitStatus
to know the actual state of limit, like theremainingAttemps
.We created a branch with this feature: see get-status-rate-limit
The text was updated successfully, but these errors were encountered: