Comments (4)
@sindresorhus I'm kind of against retry functionality in got, yet it come in handy from time to time. Here's why:
retry
will add quite a few options -retryCount
,retryDelay
and etc...- Streams will not support this without buffering and be useless by default (if retry will be enabled by default)
- Same as redirect,
retry
should be enabled only forGET
andHEAD
, right? Should it be configurable?
So it is kind of heavy feature and I believe, that retry should be added consciously by developer.
const retry = require('retry');
const got = require('got');
let result = await retry(() => { return got('google.com'); });
from got.
- Yes, more options would be added, but it is not a bad thing, is it?
- True, but we can mention this behavior explicitly in the docs
retry
would be enabled for all requests, because it would retry requests only on network failures, like EAI_AGAIN, ETIMEDOUT, etc.
So, to sum up, the implementation would be pretty lightweight, but the benefits are obvious. The only point is to deal with network failures, not response failures (interpreting status code, etc).
from got.
I didn't mean we should implement all the retry options. I just want a option-less sane default.
The benefit of including it in core is that all consumers benefit without doing any extra work, or more importantly without having to know it's needed in the first place. Most wouldn't even be aware they should be using retry
with got
. If we decide to recommend it in the readme instead, all got
consumers will have to do the same with their readmes, etc...
from got.
The only point is to deal with network failures, not response failures
@vdemedes then I misunderstood issue a little - in this case streams still can be in game. Cool 🌴
from got.
Related Issues (20)
- Getting the IP address for failed requests due to timeout
- Post request to API returns response code 500 (Internal Server Error) whereas CURL returns 200 status code HOT 2
- Timeouts are longer than expected HOT 1
- NPM Says: Types are not integrated HOT 1
- FormData getLength can error out when some file input is unknown stream.
- POSTs whose bodys are instances of createReadStream hang with latest node HOT 5
- Apply `applyDestroyPatch` for v11.x
- Stream report downloadProgress when redirects HOT 1
- Is TypeScript support outdated? HOT 1
- Good News for CJS
- afterResponse hook is not called after a retryWithMergedOptions() HOT 3
- HTTP2 with proxy doesn't work? (http2-wrapper) HOT 2
- Error when migrating to ESM version HOT 6
- Possible function divergence in "request.setTimeout(0)"?
- Memory leak after request error
- How to setup got using env variables to use self-signed certificates? HOT 1
- Reference to type-fest (devDependency) in provided types
- Issue when I tried to install got HOT 1
- Error TS since update to 14.4.1 : responseType does not exists on type "OptionsOfUnknownResponseBody" HOT 5
- How to prevent got from logging request details on error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from got.