pscott-au / WebService-GoogleAPI-Client

Perl WebService::GoogleAPI::Client Module
https://pscott-au.github.io/WebService-GoogleAPI-Client/
Other
1 stars 2 forks source link

Improve User Agent handling of rate limit errors #2

Closed mchscott closed 3 years ago

mchscott commented 5 years ago

Is your feature request related to a problem? Please describe. rate handling errors are not clearly articulated and require extra management by the developer.

Describe the solution you'd like Exponential back off during agent life when encounter a 5xx or 429 reponse codes

Describe alternatives you've considered Currently this is left to the application developer - could die when experience these errors or default sleep perhaps.

Additional context https://cloud.google.com/iot/docs/how-tos/exponential-backoff

rabbiveesh commented 3 years ago

I don't think the library should handle rate limiting errors. There are a lot of different ways that you could handle rate limiting, so it doesn't make sense to implement one by default. I personally use this library with a job queue, so I specifically don't want to have it retry, I'm managing it with job retries.

Anyways, the programmer always is responsible to check for error codes.

The idea of dying on an error code is tempting, but, unfortunately would be a breaking change. Perhaps we'll consider it in the future.