Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(retry): be more specific about when we retry
Retries are now attempted only for specific known errors. All other will fail fast. Additionally, requests will be retried on 404s and rate-limiting status codes 420 (for Twitter) and 429, along with the original 408 and 500-level error codes. All other codes will continue to fast-path to request failure. One big effect of this is that requests are no longer retried on ENOTFOUND -- that is, the getaddrinfo DNS failure error. When this happens, the problem is almost certainly that the user is currently offline. In combination with conditional requests and the cache rules, this means that make-fetch-happen now has effectively an "offline mode", where the `default` cache mode will only fail on ENOTFOUND if there is no cache entry available. As before, if we're using a stale locally-cached request due to an error (again, such as ENOTFOUND), a `Warning: 111` header will be added to the response, so you can check that field to figure out what make-fetch-happen did. BREAKING CHANGE: Retry logic has changes. * 404s, 420s, and 429s all retry now. * ENOTFOUND no longer retries. * Only ECONNRESET, ECONNREFUSED, EADDRINUSE, ETIMEDOUT, and `request-timeout` errors are retried.
- Loading branch information