Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望提供重试的功能 #94

Closed
hojit opened this issue Nov 18, 2019 · 7 comments
Closed

希望提供重试的功能 #94

hojit opened this issue Nov 18, 2019 · 7 comments
Labels
enhancement New feature or request

Comments

@hojit
Copy link

hojit commented Nov 18, 2019

希望可以根据自定义条件进行重试,类似于resty这个golang http库的重试功能。

@guonaihong guonaihong added the enhancement New feature or request label Nov 18, 2019
@guonaihong
Copy link
Owner

ok,v0.0.4或者v0.0.5会提供该功能

@hojit
Copy link
Author

hojit commented Nov 23, 2019

ok,v0.0.4或者v0.0.5会提供该功能
会第一时间试用此功能

@guonaihong
Copy link
Owner

备注下算法来源:

https://amazonaws-china.com/cn/blogs/architecture/exponential-backoff-and-jitter/

了解完算法,就开撸。

@guonaihong
Copy link
Owner

算法看完了,只是y = ax + b的变种。外一个随机数防止一起发请求。

伪代码如下

 err := GET("www.qq.com).
        Filter().
        Retry().
        Attempt(3). //最多尝试次数
        WaitTime(time.Millisecond * 10).          //基本等待时间
        MaxWaitTime(time.Millisecond * 800). //最长等待时间
        Do()

@hojit 看下伪代码有没有疑惑的地方。。。。

guonaihong added a commit that referenced this issue Dec 12, 2019
guonaihong added a commit that referenced this issue Dec 15, 2019
* 新增重试功能, #94

* 新增测试用例

* merge master 代码

* 重试功能代码基本ok

* retry整理文档,和测试

* 清理下用不到的代码

* retry 更新测试代码
@guonaihong
Copy link
Owner

guonaihong commented Dec 15, 2019

@hojit retry功能已经开发完毕,已经合并到master分支,下载最新代码即可。欢迎试用。

@hojit
Copy link
Author

hojit commented Dec 23, 2019

太棒了。

@guonaihong
Copy link
Owner

guonaihong commented Dec 23, 2019

后面有什么要加功能的想法,可以直接提。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants