- Notifications
You must be signed in to change notification settings - Fork14
♻️ The most advanced interruptible mechanism to perform actions repetitively until successful.
License
kamilsk/retry
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The most advanced interruptible mechanism to perform actions repetitively until successful.
The retry based onRican7/retry but fully reworked and focused on integrationwith the 🚧breaker and the built-incontext package.
ctx,cancel:=context.WithTimeout(context.Background(),time.Minute)defercancel()action:=func(ctx context.Context) (errerror) {req:=req.Clone(ctx)resp,err=http.DefaultClient.Do(req)returnerr}how:= []retry.How{strategy.Limit(5),strategy.BackoffWithJitter(backoff.Fibonacci(10*time.Millisecond),jitter.NormalDistribution(rand.New(rand.NewSource(time.Now().UnixNano())),0.25,),),}iferr:=retry.Do(ctx,action,how...);err!=nil {log.Fatal(err)}
A full description of the idea is availablehere.
I developed distributed systems atLazada, and later atAvito,which communicate with each other through a network, and I need a package to makethese communications more reliable.
rewriting...
The library usesSemVer for versioning, and it is notBC-safe through major releases.You can usego modules to manage its version.
$ go get github.com/kamilsk/retry/v5@latest
...
See more detailshere.
made with ❤️ for everyone
About
♻️ The most advanced interruptible mechanism to perform actions repetitively until successful.