tesla icon indicating copy to clipboard operation
tesla copied to clipboard

Setting retry delay on runtime.

Open yuchunc opened this issue 1 year ago • 1 comments

Hello, 👋

I'm trying to create a retry strategy that retries based on Zendesk's rate limit response. The response looks something like this:

< HTTP/1.1 429
< Server: nginx/1.4.2
< Date: Mon, 04 Nov 2013 00:18:27 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 85
< Connection: keep-alive
< Status: 429
< Cache-Control: no-cache
< X-Zendesk-API-Version: v2
< Retry-After: 93
< X-Zendesk-Origin-Server: ****.****.***.*****.com
< X-Zendesk-User-Id: 338231444
< X-Zendesk-Request-Id: c773675d81590abad33i
<
* Connection #0 to host SUBDOMAIN.zendesk.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
Rate limit for ticket updates exceeded, please wait before updating this ticket again

In the headers, it tells us how many seconds to wait with Retry-After header. However, looking at Tesla.Middleware.Retry, it does not seem like I can set delay base on the response on runtime. If this is something Tesla retry is missing, maybe I can submit a PR? 🙂

yuchunc avatar Oct 31 '23 10:10 yuchunc

maybe I can submit a PR? 🙂

🥳 please do, I am gonna be helping you with it

yordis avatar Oct 31 '23 19:10 yordis