-
Notifications
You must be signed in to change notification settings - Fork 935
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
Fix/consul unreg #973
Fix/consul unreg #973
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #973 +/- ##
===========================================
- Coverage 59.92% 59.59% -0.34%
===========================================
Files 261 261
Lines 12915 12903 -12
===========================================
- Hits 7739 7689 -50
- Misses 4223 4247 +24
- Partials 953 967 +14
Continue to review full report at Codecov.
|
@@ -91,6 +95,7 @@ func (r *consulRegistry) Register(url *common.URL) error { | |||
|
|||
// register actually register the @url | |||
func (r *consulRegistry) register(url *common.URL) error { | |||
r.registeredURLs = append(r.registeredURLs, url.Clone()) |
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.
问一个问题,在还没有注册consul之前就应该添加上去吗?
但是如果在注册成功之后,因为buildService(url)因为传进去的是url的引用,会修改掉url的参数,所以也会问题.
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.
- 我认为在注册前把url添加进数组没有问题。
因为最终destroy的时候,即使unregister不存在的url也无妨。 - 因为buildServicce会对url进行修改,而其中buildid函数是根据修改前的url生成的id,在unregister的时候,也必须严格使用修改前的url来生成id,所以这里临时把修改前的拷贝了出来,用于unregister。
b6022bb
to
9e40791
Compare
registry/consul/registry.go
Outdated
select { | ||
case <-done: | ||
logger.Infof("consulRegistry unregister done") | ||
case <-time.After(registryDestroyDefaultTimeout): |
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.
using getty.GetTimeWheel().After(registryDestroyDefaultTimeout)
instead.
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.
fixed!
ca6b03e
to
34fa1da
Compare
d12bf6a
to
e633a73
Compare
What this PR does:
fix consul unregister bug.
Which issue(s) this PR fixes:
Fixes #749
Special notes for your reviewer:
I record the copy of every registry url, and make sure the unregistry url is we wanted.
Does this PR introduce a user-facing change?: