zlacker

[parent] [thread] 2 comments
1. jlund-+(OP)[view] [source] 2023-07-02 00:50:28
I’d bet (not that much, but like $20) that someone has a .ifClientError() or if responseStatus === 4xx somewhere.

If you’ve never had to handle authorization in a particular area, it might have been safe to assume that any 4xx error should have been retried when the code was originally written and someone didn’t write them all out

replies(1): >>wongar+c1
2. wongar+c1[view] [source] 2023-07-02 01:00:10
>>jlund-+(OP)
But wouldn't responseStatus === 4xx indicate that the problem is on your end and retrying is unlikely to fix the issue. A 5xx is worth a retry, a 4xx should imho just produce an error message.

And even if you do retry, exponential backoff has been the standard for a long time (and is mentioned by the Twitter API documentation as a good solution to 429 responses)

replies(1): >>crater+44
◧◩
3. crater+44[view] [source] [discussion] 2023-07-02 01:24:31
>>wongar+c1
There are libraries, usually under the general heading of "circuit breaker", that handle 429 and other reasons to retry in a sane manner. I'm not a JS expert but I believe either yammer/circuit-breaker-js or nodeshift/opossum would work in the browser. Even a hand-coded exponential backoff with jitter is simple enough to do for most cases.
[go to top]