Async Data Pipeline
Advanced
35 XP
You're trying this as a guest: your result shows here but isn't saved.
Sign in
Build a robust async data pipeline — essential for modern web development.
Tasks:
- Write
fetchWithRetry(url, maxRetries=3) — fetches a URL and retries on failure up to maxRetries times with exponential backoff.
- Write
processBatch(urls) — uses Promise.allSettled to fetch all URLs in parallel, separates successes from failures, and returns {successes: [...], failures: [...]}.
- Write
pipeline(urls, transform) — fetches all URLs, applies a transform function to each successful result, and returns the transformed data.
Handle all edge cases: network errors, timeouts, empty arrays.
To pass
- Should have 2 successful responses
- Should have 1 failure
Need a hint?
- Use a for loop with try/catch for retry logic. await a setTimeout promise for delay.
- Promise.allSettled returns objects with {status: 'fulfilled', value} or {status: 'rejected', reason}.
- Use .filter() and .map() to separate fulfilled from rejected results.