Code Monkey home page Code Monkey logo

Comments (4)

floatdrop avatar floatdrop commented on April 29, 2024

@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 for GET and HEAD, 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.

vadimdemedes avatar vadimdemedes commented on April 29, 2024

@floatdrop

  • 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.

sindresorhus avatar sindresorhus commented on April 29, 2024

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.

floatdrop avatar floatdrop commented on April 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.