typescript.unbounded_retry
Stability
High
Detects retry loops without maximum attempt limits.
Why It Matters
Section titled “Why It Matters”Unbounded retries:
- Infinite loops — Never give up on permanent failures
- Amplify load — Retry storms overwhelm upstream
- Waste resources — CPU/network spent on hopeless retries
Example
Section titled “Example”// ❌ Before (unbounded retry)async function fetchData(): Promise<Data> { while (true) { try { return await axios.get('/data'); } catch { await sleep(1000); } }}// ✅ After (with max retries and backoff)import retry from 'async-retry';
async function fetchData(): Promise<Data> { return retry( async () => { return axios.get('/data'); }, { retries: 3, factor: 2, minTimeout: 1000, maxTimeout: 10000, } );}What Unfault Detects
Section titled “What Unfault Detects”- While(true) retry loops
- Missing max retry count
- No exponential backoff
Auto-Fix
Section titled “Auto-Fix”Unfault can add retry limits using async-retry.