Node.js · Middle · Question 27 of 75
Why should every outgoing HTTP call have a timeout?
- 1Node.js refuses to send requests without a timeout
- 2Timeouts make requests faster
- ✓Correct answer: Without one, a slow dependency can hold requests and resources open indefinitely and the service piles up work
Explanation
For example, fetch(url, { signal: AbortSignal.timeout(3000) }). Combine timeouts with limited retries and backoff for transient errors.