Replies: 6 comments 3 replies
-
Something like this:
|
Beta Was this translation helpful? Give feedback.
-
Hello @gcuadrado As i know if get error 429 then you will get the true ratelimit , do you test this code ? |
Beta Was this translation helpful? Give feedback.
-
Hi @abuzuhri it is not tested, it is just an idea. I don't understand what do you mean with "true rate limit". (Maybe I have to read again this part of Amazon documentation) If you get 429 you won't get the result for your request, but if you wait and repeat the request, you will get the correct result |
Beta Was this translation helpful? Give feedback.
-
Hi @gcuadrado What I mean is If there is exception (429) happen then no rate limit return at header ? |
Beta Was this translation helpful? Give feedback.
-
I have been testing. You were right, if you reach the limit and get the 429, you won't have the rate limit header. Maybe we can add a sleepTime property to AmazonConnection class and pass it as reference to all their services classes that inhertis from RequestService. When execute a request, if it's correct, we update the sleepTime value based on rate limit header, if it's fails, we wait the time specified in sleepTime property. With this way we could share sleepTime across all services, the cons are that sleepTime would be different for each AmazonConnection instance, but in normal conditions, we should have only one. |
Beta Was this translation helpful? Give feedback.
-
I will try next week to work in best solution to solve this problem , also if you can with good solution we can speak about it i will take look to other library and see how they solve it |
Beta Was this translation helpful? Give feedback.
-
At the moment, if we have the IsActiveLimitRate set to true, after every request, we have to wait a while based on x-amzn-RateLimit-Limit value.
I think it's should be better if we don't wait by default. We should only wait if a request fails with 429 code, in this case, we should wait and then retry the request.
What do you think about it?
Beta Was this translation helpful? Give feedback.
All reactions