项目
在 GitHub 查看
kamilsk/retry
关于
♻️ 功能先进的可中断机制,可重复执行操作,直到成功为止。
其他项目实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文♻️ retry
The most advanced interruptible mechanism to perform actions repetitively until successful.
💡 Idea
The retry based on Rican7/retry but fully reworked and focused on integration with the 🚧 breaker and the built-in context package.
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
action := func(ctx context.Context) (err error) {
req := req.Clone(ctx)
resp, err = http.DefaultClient.Do(req)
return err
}
how := []retry.How{
strategy.Limit(5),
strategy.BackoffWithJitter(
backoff.Fibonacci(10*time.Millisecond),
jitter.NormalDistribution(
rand.New(rand.NewSource(time.Now().UnixNano())),
0.25,
),
),
}
if err := retry.Do(ctx, action, how...); err != nil {
log.Fatal(err)
}
A full description of the idea is available here.
🏆 Motivation
I developed distributed systems at Lazada, and later at Avito, which communicate with each other through a network, and I need a package to make these communications more reliable.
🤼♂️ How to
rewriting...
🧩 Integration
The library uses SemVer for versioning, and it is not BC-safe through major releases. You can use go modules to manage its version.
$ go get github.com/kamilsk/retry/v5@latest
🤲 Outcomes
Console tool to execute commands until successful
...
See more details here.
made with ❤️ for everyone
探索相关项目
加载中…