Command Palette

Search for a command to run...

Hectal
Phase 16: Dashboards in Production
Data Visualization · Exercise 5 of 5 Previous
Advanced

Retry with backoff

withRetry(task, { tries, wait, sleep }) should call task(attempt), and after a failure wait wait, then 2 × wait, then 4 × wait, up to tries attempts. The last failure is thrown.

The starter waits a fixed time. Make the waits double. The page logs the waits it used.

What Check tests

  1. It succeeds on the third try
  2. The waits double: 100 then 200
  3. A task that always fails throws its last error
  4. The number of tries is respected

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.