Hi,
I'm trying to address an issue with my app which I submitted to the app store, but has blockers. The final blocker is to do with rate limiting. I was given the following instruction:
- We ask that you include a backoff and proper 429 error messaging for rate limiting. You should implement a custom back off strategy in an exponential fashion (1s, 2s, 5s, 10s, 30s, 5 min intervals).
I have first implemented an error trap for 429 errors. It looks like this:
myURL = "retry"
while(myURL = "retry"){
myURL = await client.request(settings).then(
function(data) {
// DO STUFF
},
async function(response) {
if (response.status === 429) {
const retryAfter = response.headers.get('retry-after')
console.log("429 error")
await sleep(retryAfter)
return "retry"
}
else
{
// DO SOMETHING ELSE
}
},
);
}
I was hoping that this approach would make it unnecessary to implement the exponential back off -- as after the 429 error, it would wait the appropriate amount of time before retrying the API. When testing this I have found that no 429 errors are occurring (or at least no message is going to the console). But I am getting this warning to the console:
... app request has been throttled: /api/v2/search.json?query=...etc
First, would I still need the exponential back-off strategy if I am using the 'wait until', as above.
Second, can anyone explain why I am getting throttling messages but no 429 error.
Help is appreciated.
Thanks.
To that end, I'd like to see your implementation of the request just in case there's something funny in the options. If you wouldn't mind passing along the settings you're using for that (and the rest of the block as well), I'll be glad to look into this!