Skip to content

typescript.unbounded_retry

Stability High

Detects retry loops without maximum attempt limits.

Unbounded retries:

  • Infinite loops — Never give up on permanent failures
  • Amplify load — Retry storms overwhelm upstream
  • Waste resources — CPU/network spent on hopeless retries
// ❌ 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,
}
);
}
  • While(true) retry loops
  • Missing max retry count
  • No exponential backoff

Unfault can add retry limits using async-retry.