-
Notifications
You must be signed in to change notification settings - Fork 2.6k
modify balancer.lua to solve issue that discovery Eureka cannot autom… #2793
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
Conversation
…atically proxy to a new node
@Hmemories CI run is failed, please take a look :). |
@Hmemories Missing test cases. |
@@ -218,8 +219,9 @@ local function pick_server(route, ctx) | |||
if checker then | |||
version = version .. "#" .. checker.status_ver | |||
end | |||
local cache_key = key..ngx.md5(up_conf.nodes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: need space on both left and right side of ..
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument type of ngx.md5
is string while up_conf.nodes
is an array-like table.
BTW, i don't think calculating the md5sum of nodes is a good way to differentiate the version, it's heavy, what about introducing the version mechanism for up_conf.nodes
, either version number or last modify time is OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or settling for the second best, just use the up_conf.version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯嗯,我准备在看看,这部分代码已经被我是用在了生产环境我在考虑有没有好的方式优化它
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果md5比较重的话,hash是不是也可以
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
md5 is good to me
@Hmemories it will be perfect if you can add test cases |
ping @Hmemories |
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions. |
This pull request/issue has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
…atically proxy to a new node
What this PR does / why we need it:
to solve issue that discovery Eureka cannot automatically proxy to a new node #1838
Pre-submission checklist:
When we are getting the cached data, if we match "key" with the data"md5" of up_conf.nodes, we can find the changes of the service.