question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle http error 429 too many requests

See original GitHub issue

Describe the bug We’re using coil version 2.0.0-rc02. We use coil to display thumbnails in an image gallery. When we use the fast scrollbar to browse images, we sometimes receive an http error 429 “too many requests” from our backend because we loaded too many thumbnails in a short amount of time.

To Reproduce

  • Create an image gallery with a lot of images
  • Add a scrollbar
  • Browse quickly enough using the scrollbar to trigger more requests than the backend can handle (e.g. go up and down quickly using the scrollbar)
  • Observe that some pictures thumbnails api call failed due to “too many requests” http error 429

Logs/Screenshots

I/RealImageLoader: 🚨 Failed - https://... - coil.network.HttpException: HTTP 429: 
2022-04-06 14:43:56.627 E/RealImageLoader: coil.network.HttpException: HTTP 429: 
        at coil.fetch.HttpUriFetcher.executeNetworkRequest(HttpUriFetcher.kt:227)
        at coil.fetch.HttpUriFetcher.access$executeNetworkRequest(HttpUriFetcher.kt:30)
        at coil.fetch.HttpUriFetcher$executeNetworkRequest$1.invokeSuspend(Unknown Source:15)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

illustration

The failed pictures display our “default thumbnail”

Version 2.0.0-rc02

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sirambdcommented, Apr 12, 2022

Okay I understand @colinrtwhite but I think it’s a pity that coil doesn’t do it automatically, as I didn’t have this problem with glide. It would be interesting to have an extension for recyclerview that limits the loading from remote when scrolling.

0reactions
JorisBodincommented, May 10, 2022

Okay I understand @colinrtwhite but I think it’s a pity that coil doesn’t do it automatically, as I didn’t have this problem with glide. It would be interesting to have an extension for recyclerview that limits the loading from remote when scrolling.

I also find it interesting

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid HTTP error 429 (Too Many Requests) python
1) Sleep your process. The server usually includes a Retry-after header in the response with the number of seconds you are supposed to...
Read more >
What an HTTP Error 429 Means & How to Fix It - HubSpot Blog
The most simple way to avoid this error is to reduce the number of requests made in a short period of time. The...
Read more >
How to Fix 429 Too Many Requests Error Code - Hostinger
6 Ways to Fix the 429 Too Many Requests Error · 1. Flush Cache · 2. Check Your Order Usage on hPanel ·...
Read more >
429 Error – Too Many Requests HTTP Code Explained
The most common cause of the 429 error is not having enough resources to handle so many concurrent requests. For example, if this...
Read more >
Handling the “HTTP 429 – Too Many Requests” error when ...
The HTTP 429 - Too Many Requests response status code indicates the user has sent too many requests in a given amount of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found