-
Notifications
You must be signed in to change notification settings - Fork 929
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
refactor listenDirEvent #1589
refactor listenDirEvent #1589
Conversation
1. remove CLEAR label; 2. remove register/unregister logic for watch children; 3. reorder the zk dynamic configuration code 4. adapt the gost
Codecov Report
@@ Coverage Diff @@
## 3.0 #1589 +/- ##
==========================================
+ Coverage 41.15% 41.29% +0.14%
==========================================
Files 250 250
Lines 14277 14262 -15
==========================================
+ Hits 5875 5890 +15
+ Misses 7719 7689 -30
Partials 683 683
Continue to review full report at Codecov.
|
@@ -150,7 +150,11 @@ func (r *zkRegistry) InitListeners() { | |||
|
|||
// CreatePath creates the path in the registry center of zookeeper | |||
func (r *zkRegistry) CreatePath(path string) error { | |||
return r.ZkClient().Create(path) | |||
err := r.ZkClient().Create(path) | |||
if err != nil && err != zk.ErrNodeExists { |
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.
IMO, using errors.Is() is better than !=
.
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.
I think != is just ok
@@ -80,15 +81,20 @@ func newZookeeperDynamicConfiguration(url *common.URL) (*zookeeperDynamicConfigu | |||
logger.Errorf("zookeeper client start error ,error message is %v", err) | |||
return nil, err | |||
} | |||
err = c.client.Create(c.rootPath) | |||
if err != nil && err != zk.ErrNodeExists { |
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.
errors.Is
What this PR does:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: