Menu

Why I never auto-retry a download that already charged quota
πŸ“°

Why I never auto-retry a download that already charged quota

DEV Community: phpΒ·Mobeen AhmedΒ·10 days ago
#OVNK8BTt
#devto#dev#retry#request#provider
Long article (614 words) β€” no AI summary yet.
Reading 0:00
15s threshold

When you build a downloader that runs on other people's APIs, retries feel like free insurance. A request fails, so you try again. What could go wrong? On my own site, quite a lot, and it took me one expensive afternoon to learn the difference between a retry that helps and a retry that just burns quota.

The site I run is ramrom.io , a free video downloader for TikTok, Instagram, Facebook and YouTube. It sits on shared hosting, plain PHP, and talks to a handful of RapidAPI providers. Most of those providers charge per request, not per success. That single fact changes how you should think about retrying.

So I drew a line, and it is simple: I retry only when I can prove the request never reached the provider.

A connection that fails before the request leaves my server is safe to retry. A DNS failure, a connect timeout, a curl error with no HTTP status at all β€” in those cases nothing was charged, because nothing arrived.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.