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

使用 TimeoutContext 是否更加的优雅 #2315

Open
alpha-baby opened this issue May 25, 2023 · 5 comments
Open

使用 TimeoutContext 是否更加的优雅 #2315

alpha-baby opened this issue May 25, 2023 · 5 comments

Comments

@alpha-baby
Copy link
Member

alpha-baby commented May 25, 2023

https://github.com/mosn/mosn/blob/42c4dc0563480a508822b1e106dac789732d5eab/pkg/upstream/healthcheck/session_checker.go#LL162C22-L162C33

CheckHealth 方法

@alpha-baby
Copy link
Member Author

@doujiang24 @taoyuanyuan

@doujiang24
Copy link
Member

感觉可以试试看的

@alpha-baby
Copy link
Member Author

感觉可以试试看的

如果直接在 CheckHealth 方法上加上一个入参 ctx 会破坏兼容性,如果要做一个好的兼容性的话,是不是可以新开一个 接口,比如叫:HealthCheckSessionV2,

或者还有其他比较好的方式吗?

@zlasd
Copy link

zlasd commented Jul 17, 2023

参考go标准库升级http.Do的方式,可以把context放进结构体里 https://go.dev/blog/context-and-structs

@alpha-baby
Copy link
Member Author

参考go标准库升级http.Do的方式,可以把context放进结构体里 https://go.dev/blog/context-and-structs

https://github.com/mosn/mosn/blob/42c4dc0563480a508822b1e106dac789732d5eab/pkg/upstream/healthcheck/session_checker.go#LL162C22-L162C33

CheckHealth 方法

这个方法是无参的

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

3 participants