Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

♻️ The most advanced interruptible mechanism to perform actions repetitively until successful.

License

NotificationsYou must be signed in to change notification settings

kamilsk/retry

Repository files navigation

The most advanced interruptible mechanism to perform actions repetitively until successful.

BuildDocumentationQualityTemplateCoverageMirror

💡 Idea

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.

🏆 Motivation

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.

🤼‍♂️ How to

rewriting...

🧩 Integration

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

🤲 Outcomes

Console tool to execute commands until successful

...

See more detailshere.

made with ❤️ for everyone


[8]ページ先頭

©2009-2025 Movatter.jp