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

gRPC 拦截器顺序的设置 #8

Open
jxlwqq opened this issue May 22, 2022 · 0 comments
Open

gRPC 拦截器顺序的设置 #8

jxlwqq opened this issue May 22, 2022 · 0 comments

Comments

@jxlwqq
Copy link
Owner

jxlwqq commented May 22, 2022

b796c75

各个拦截器的放置顺序就显得非常重要,比如为啥 panic 拦截器要放在第一个位置?如果放在后面的位置,那么假设前面拦截器运行过程中发生了 panic,就无法捕获到异常了。同理,需要对错误进行处理的拦截器,如果放置的位置不合适,获取不到相关的错误,那么该拦截器就无意义了(比如对于客户端的 breaker 熔断 / 超时重试 / 参数检查拦截器的位置,一般而言,是按照先检查输入参数 -> 熔断拦截器 -> 超时重试的顺序,因为熔断需要检查超时错误,但是对于参数校验错误就不关心)

https://pandaychen.github.io/2019/11/23/GRPC-INTERCEPTOR-APPLY/

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

No branches or pull requests

1 participant