We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
foranuj
2 years agoNew member | Level 2
Error 429 Rate limit - Too many requests
Hi, We are dealing with an application that's job is to retrieve around 10-20 images from dropbox, and pass their shared links (2 per image, one for the image and one for it's thumbnail) to a Can...
Здравко
2 years agoLegendary | Level 20
foranuj wrote:... So I do get request different links. I can add a small wait/sleep in that request and hopefully that'll take care of the issue....
Hi again foranuj,
No, adding wait, just so, wouldn't do anything. You have to add back-off only when needed, i.e. when you got rate limit (as discussed above), otherwise - no. Don't confuse by Greg's advise to avoid double request for the same link. While they are different, as you said - no such problem.
foranuj wrote:...const links = await dbx.sharingListSharedLinks({ path: dbx_path });...
It's a good idea to avoid requesting all possible shared link if you are interested in direct links only, as Greg advised you. Even more, in such a case your code can get in confusion (i.e. it's potentially buggy). Let's say you have a link to your containing folder and are trying to create link to a new file inside, but unsuccessfully for some reason. In spite unlikely, you can get as result of your code that folder' link instead of image link. Again it's unlikely, but not impossible! To avoid such situation for sure and to speed up a bit, follow the Greg's advise.
Probably my description was not clear enough. Your main issue is that you're bombarding Dropbox server with your requests, starting with all pairs of link at the same time. Normally, the result, in such a situation, is such as you saw it. To avoid this, avoid the simultaneous starting and iterate the images range instead, for instance. 😉
Hope it's a bit more clear now.
Add: You can optimize your code a bit. It's likely when shared link already exists on error indicating link existence the same already existing link to becomes passed together with the error. In your code you completely ignore this! If the link you're interested in is available already, you may skip requesting the same link. This has potential to speed up significantly your code. Simply don't perform unneeded request whenever possible (again - very often it's possible - just a simple check before the request).
foranuj
2 years agoNew member | Level 2
Thanks @Здравко
I think I now get the idea and the issues with the above code pieces. I have a different image ranking and generating process that actually puts those images on dropbox in the first place and constructs a json file indicating a few other things. I will create the shared link there, once and then place that link in the json itself. That'll simplify my code significantly and I won't have to retrieve anything other than the actual json file from dropbox.
Thanks once again for taking the time to explain the underlying issues with this line of operation.
Best always.
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!