Performance: Handling rate limits and errors
MEDIUM IMPACT
This concept affects how quickly the application recovers from API rate limits and errors, impacting user interaction speed and reliability.
import asyncio async def fetch_data(): response = await api_call() if response.status_code == 429: await asyncio.sleep(2) # wait before retry return await api_call() return response
async def fetch_data(): response = await api_call() if response.status_code == 429: # Just retry immediately return await api_call() return response
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Immediate retry on 429 error | Minimal | 0 | 0 | [X] Bad |
| Retry with delay (exponential backoff) | Minimal | 0 | 0 | [OK] Good |