Comments (2)
Actually, there're more questions than answers about rate limiting. How exactly should we handle this?
-
Throw RateLimitExceededException? If yes, then the request somehow should be repeated after we're allowed to make requests to the API. How this should be done? Save failed requests to cache/queue and repeat after 30 seconds? I don't think that caching/queueing mechanism should be added to SDK, so this must be controlled in the target application.
-
Or should we ignore failed requests and require SDK's users to repeat them manually?
-
Or even put the script to
sleep($secondsLeftBeforeNextWindow);
(that's the ugliest solution as for me and probably this won't work at all)?
At this moment, the only way I see is to throw exception on HTTP 429
responses (actually, Guzzle already throws it but we can rename it to more informational one) and let users handle it in their preferred way. What do you think?
from laravel-forge-api.
I have been thinking about this, and I feel that it might be worth offering an option. For example, setting an optional useRateLimiting
flag on the $forge
instance to which a closure is passed. The closure provides the rate limiting code, and could pause as required.
I imagine most users will only need to rate limit across one instance of an application, but this would also allow people to code an implementation which rate limited across multiple instances.
I will try and look at how this can be achieved over the next week or so and offer something up.
from laravel-forge-api.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-forge-api.