hertz icon indicating copy to clipboard operation
hertz copied to clipboard

feat: optimize client retry logic

Open CSWYF3634076 opened this issue 2 years ago • 4 comments

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.

  1. 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().
  2. Users can customize the RetryIf function through req, resp and err to realize customized retry conditions.
  3. Introduce four delay strategies: default, random, fixed and exponential. Users can customize the combination
  4. The default value of retryconfig remains to be discussed
  5. 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)

CSWYF3634076 avatar Jul 18 '22 04:07 CSWYF3634076

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 18 '22 04:07 CLAassistant

claci need solve @CSWYF3634076

li-jin-gou avatar Jul 18 '22 05:07 li-jin-gou

claci need solve @CSWYF3634076

get

CSWYF3634076 avatar Jul 18 '22 05:07 CSWYF3634076

在文档上面开一个小节整体说明一下兼容性相关的问题吧

好的,我在文档中说明一下

CSWYF3634076 avatar Jul 22 '22 15:07 CSWYF3634076

continue in #209

welkeyever avatar Aug 24 '22 10:08 welkeyever