hertz
hertz copied to clipboard
feat: optimize client retry logic
What type of PR is this?
optimize(client retry)
What this PR does / why we need it (English/Chinese):
en: Various delay backoff strategies are introduced, and the user-defined retry conditions.
- Through client SetRetryConfig (RetryConfig) injects retry config and fails to pass the client WithRetryConfig (), otherwise the circular reference seems to be unable to be solved. For the initialization of RetryConfig, use the option mode of withXXX().
- Users can customize the RetryIf function through req, resp and err to realize customized retry conditions.
- Introduce four delay strategies: default, random, fixed and exponential. Users can customize the combination
- The default value of retryconfig remains to be discussed
- The default retry condition feels to be optimized. pkg/common/retry/retry.go::DefaultRetryIf()
zh:引入了各种延迟退避策略,用户自定义重试发生条件。 1.用户通过client.SetRetryConfig(RetryConfig)注入重试配置,没有通过client.withRetryConfig()的方式,否则的话循环引用好像不能被解决。对于retryConfig的初始化使用withXXX()的选项模式。 2.用户可以通过req、resp和err来自定义RetryIf函数,实现自定义重试条件。 3.引入 默认、随机、固定、指数 四种延迟策略,用户可以自定义组合 4.retryConfig的默认值还有待商榷 5.默认重试条件感觉还有待优化。pkg/common/retry/retry.go::DefaultRetryIf()
ps:相关文档 https://bytedancecampus1.feishu.cn/docx/doxcnfQGEZeVgZFkJf4nfcazGbg ,完善中
Which issue(s) this PR fixes:
Fixes (issue63)
cla
和 ci
need solve @CSWYF3634076
cla
和ci
need solve @CSWYF3634076
get
在文档上面开一个小节整体说明一下兼容性相关的问题吧
好的,我在文档中说明一下
continue in #209