← DevOps Foundations
4 / 25
Lesson 4 — Retry with backoff
Wait longer each time
When a call to another service fails, retrying instantly often fails again. Backoff means waiting before each retry, and exponential backoff doubles the wait each time: 100 ms, 200 ms, 400 ms… This gives the other service time to recover.
price *= 3; // same as price = price * 3
Why it matters: sensible retries fix short glitches without hammering a struggling server.
Want it another way?
Task
Inside the loop, after logging, double the delay so it logs 100, 200, 400 and 800.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
Test your knowledge
A quick 3-question quiz on this lesson — instant feedback.