avast/retry-go

infinite retry ??

tech-a-go-go opened this issue · 2 comments

Hi there,

How can I make infinite retry ??

Thanks

JaSei commented

Hi.
We don't support 'infinite' retry. I'm not sure, if it makes sence. Billions of retries sounds like problem and no like feature.

You can set max of uint (4,294,967,295) set to Attempts if you need simulate 'infinite' retry.

eg.

import (
    "math"

   "github.com/avast/retry-go"
)

...

err := retry.Do(
    func() error {
        ...
    },
    Attempts(math.MaxUint32),
)
fishy commented

There's actually a "bug" that when you use infinite/very large number of attempts with the default backoff delay policy, attempts after a certain number (~40 but depends on the initial delay value you set) will have the delay becoming 0 because of overflow. This will be fixed in #30