Giter Site home page Giter Site logo

Rate limiting about laravel-forge-api HOT 2 CLOSED

tzurbaev avatar tzurbaev commented on August 15, 2024
Rate limiting

from laravel-forge-api.

Comments (2)

tzurbaev avatar tzurbaev commented on August 15, 2024

Actually, there're more questions than answers about rate limiting. How exactly should we handle this?

  1. 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.

  2. Or should we ignore failed requests and require SDK's users to repeat them manually?

  3. 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.

acurrieclark avatar acurrieclark commented on August 15, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.