GithubHelp home page GithubHelp logo

WaitAndRetry about retry-go HOT 3 CLOSED

avast avatar avast commented on September 18, 2024
WaitAndRetry

from retry-go.

Comments (3)

JaSei avatar JaSei commented on September 18, 2024

Hi @jurabek the idea of your snippet is first to try delay is 1s, second 2s, third 3s, and next one 3s too? I think this is possible to do by custom DelayFunction. I maybe add some examples of how to make custom DelayFunctions to README or examples.

from retry-go.

JaSei avatar JaSei commented on September 18, 2024

Great I have it in examples
https://github.com/avast/retry-go/blob/master/examples/custom_retry_function_test.go

in your case can be easily solved by something like:

retry.DelayType(func(n uint, config *retry.Config) time.Duration {
                        switch n {
                        case 1:
                            return 1
                        case 2:
                            return 2
                        default:
                            return 3
                        }
		}),

from retry-go.

jurabek avatar jurabek commented on September 18, 2024

Hi @JaSei, yes this one was exactly what I need, thank you for the example.

from retry-go.

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.