Why setTimeout is Lying to Your Retry Logic (opens in new tab)
You've written retry logic. It probably looks something like this: async function withRetry(fn, retries = 3) { for (let i = 0; i setTimeout(r, 200 * (i + 1))); } } } You test it locally. You simulate a slow dependency like this: const fakeDB = async () => { await new Promise(r => setTimeout(r, 200)); // simulate DB return { id: 1, name: 'test' }; }; Your retry logic works. Tests...
Read the original article