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

重试配置maxRetryCount不生效 #111

Closed
AlexPfbkdzy opened this issue Nov 13, 2022 · 5 comments
Closed

重试配置maxRetryCount不生效 #111

AlexPfbkdzy opened this issue Nov 13, 2022 · 5 comments

Comments

@AlexPfbkdzy
Copy link

版本:
com.dtflys.forest
forest-spring-boot-starter
1.5.16

配置
@Retry(maxRetryCount = "1", condition = MyRetryCondition.class)

当业务返回码为异常值时,MyRetryCondition返回true,请求会一直重试
跟踪进代码发现,每次重试记录重试次数的变量都为一个新的对象

private AtomicInteger currentRetryCount = new AtomicInteger(0);

@mySingleLive
Copy link
Collaborator

你的 MyRetryCondition 是如何定义的?

@AlexPfbkdzy
Copy link
Author

覆盖retryWhen方法,当响应码为 401时返回true,否则返回false
image

@AlexPfbkdzy
Copy link
Author

另外,自定义拦截器实现了重试方法,用于token无感刷新,但是获取token失败时会一直重试,设置的最大重试次数无效
image

@AlexPfbkdzy
Copy link
Author

感谢作者,我知道怎么回事了,应该过滤token接口的重试

@mySingleLive
Copy link
Collaborator

好的,不客气

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

2 participants