Home > Mobile >  Recieveing code 429 with Android's Volley, how to delay requests?
Recieveing code 429 with Android's Volley, how to delay requests?

Time:08-20

Just started learning Kotlin and HTTP requests with Volley.

The API doesn't allow to get all information i need in a single request. I need to do one request per row of table i want to fill.

Essentially one request equals one product information.

I'm assuming this is what is leading me to the 429 code response, exceeding quantity of requests in a short period of time.

As my table will hold hundreds of products, which are my options here?

EDIT: An endpoint of the API gives 50 products' data at once. Makes more sense now.

CodePudding user response:

Volley RequestQueue has the RetryPolicy value that can be assigned with different timeout in ms, number of tries...

Adjusting the values to match API restrictions has solved the issue.

Another option might involve having a Handler or a Timer that waits for some time before adding the HTTP requests to the queue, but displaying data "as fast as the API allows" seems better to me.

  • Related