Coder Social home page Coder Social logo

Comments (3)

mtdowling avatar mtdowling commented on April 25, 2024

Passing the response to the method sounds like a good idea. I won't be able to get to this for a few days, so a PR would be awesome :)

On May 25, 2012, at 2:50 PM, David [email protected] wrote:

I am trying to add support for HTTP 429 responses to a web service client I am developing. Specifically, I was attempting to specify my own callable $failureCodes function and checking for the header presence in the response.

However, the problem I ran into is that I have no way to handle this with the current implementation of the ExponentialBackoffPlugin. With the current design there is no way for the "should we retry" callback to "tell" the "calculateWait" callback how long to delay. The calculateWait callback can't determine that for itself either since it doesn't have access to the Response object.

The two options I see:

  • The ExponentialBackoffPlugin could natively support 429 and handle Retry-After headers (note: Retry-After is not exclusive to 429 responses)
  • Pass the Response object (if any) to the calculate wait method so that I could check the Retry-After header in my client code

I don't have a problem implementing either, but the former seems like it may be a more robust approach (less client code, and potentially useful to many) albeit greater in scope. Please let me know your thoughts.


Reply to this email directly or view it on GitHub:
#63

from guzzle.

mtdowling avatar mtdowling commented on April 25, 2024

The request object is now passed to the calculateWait() function of the exponential backoff plugin. You'll need to get the response object from the request in your callback function to do any custom checks. Make sure that a response is associated with the request though. Some cURL related errors might trigger the exponential backoff plugin and a response will not be associated with the request.

from guzzle.

hobodave avatar hobodave commented on April 25, 2024

Thanks @mtdowling ! I was too busy with the holiday weekend to do a PR; I would have this week, but you beat me to it.

from guzzle.

Related Issues (20)

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.