Code Monkey home page Code Monkey logo

Comments (1)

rahpuser avatar rahpuser commented on August 20, 2024

Inverting the array would break the maxTimeout, wouldn't ?. now the minTimeout would also be the maxTimeout ?

> r.timeouts({factor: 0.5, retries: 3, minTimeout: 1000})
[ 1000, 500, 250 ] // original result

A good output to be consistent with others timeouts would be
[1000, 1250, 1500]

Let me know what are yours thoughts about it.

UPDATE.
I just realized about another option, a factor < 1, implicitly says it wants to grow each time less, so consider the normal output:

> r.timeouts({factor: 0.5, retries: 3, minTimeout: 1000})
[ 1000, 500, 250 ] // 125, 87, etc

A timeouts array that grow each time less:

original output:          [ 1000, 500, 250 ] // 125, 87, etc
slow grow 1:        [1000, 2000, 2500, 2750] 
slow grow 2:              [1000, 1500, 1750]

This last example for me is more natural for what factor < 1 should be doing.

In the other hand, the output [ 250, 500, 1000 ] is easy to get if you specify the correct timeouts parameters in the following way:

> retry.timeouts({factor: 2, retries: 3, minTimeout: 250})
[ 250, 500, 1000 ]

So, please let me know what do you guys think about this.
@tim-kos @felixge

from node-retry.

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.