Skip to content
_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN DE
Let's talk

Retry Pattern — Smart Retries

24. 02. 2024 Updated: 27. 03. 2026 1 min read intermediate

Architecture Beginner

Retry Pattern — Smart Retries

RetryResilienceError Handling 3 min read

Proper implementation of retry logic. Exponential backoff, jitter and when NOT to retry.

Exponential Backoff with Jitter

async function retryWithBackoff(fn, maxRetries = 3) {
    for (let attempt = 0; attempt <= maxRetries; attempt++) {
        try { return await fn(); }
        catch (error) {
            if (attempt === maxRetries) throw error;
            if (!isTransient(error)) throw error;
            const delay = Math.pow(2, attempt) * 1000 * (0.5 + Math.random() * 0.5);
            await sleep(delay);
        }
    }
}
function isTransient(error) {
    const s = error.response?.status;
    return s === 429 || s === 503 || s >= 500;
}

When NOT to Retry

  • 4xx errors (except 429)
  • Non-idempotent operations without an idempotency key
  • Authentication errors (401/403)
  • Long-running operations

Summary

Exponential backoff + jitter + max retries. Only retry transient errors and idempotent operations.

Need Help with Implementation?

Our team has experience designing and implementing modern architectures. We’re happy to help.

Free Consultation

Share:

CORE SYSTEMS team

We build core systems and AI agents that keep operations running. 15 years of experience with enterprise IT.