-
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
add zk register code #355
add zk register code #355
Conversation
Codecov Report
@@ Coverage Diff @@
## 1.3 #355 +/- ##
=========================================
+ Coverage 66.68% 67.88% +1.2%
=========================================
Files 118 118
Lines 7419 7099 -320
=========================================
- Hits 4947 4819 -128
+ Misses 1981 1809 -172
+ Partials 491 471 -20
Continue to review full report at Codecov.
|
rawURL string | ||
encodedURL string | ||
dubboPath string | ||
//conf config.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.
if useless then delete
func (r *BaseRegistry) register(c common.URL) error { | ||
var ( | ||
err error | ||
//revision string |
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.
if useless then delete
|
||
params.Add("pid", processID) | ||
params.Add("ip", localIP) | ||
//params.Add("timeout", fmt.Sprintf("%d", int64(r.Timeout)/1e6)) |
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.
if useless then delete
// Dubbo java consumer to start looking for the provider url,because the category does not match, | ||
// the provider will not find, causing the consumer can not start, so we use consumers. | ||
// DubboRole = [...]string{"consumer", "", "", "provider"} | ||
// params.Add("category", (RoleType(PROVIDER)).Role()) |
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.
if useless then delete
) | ||
|
||
// ZookeeperClient ... |
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.
add some comment for this struct
) | ||
|
||
import ( | ||
"github.com/apache/dubbo-go/common/logger" | ||
"github.com/apache/dubbo-go/remoting" | ||
) | ||
|
||
// ZkEventListener ... |
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.
add some comment for this struct
) | ||
|
||
// Options ... |
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.
add some comment for this struct
@@ -36,18 +36,23 @@ import ( | |||
zk "github.com/apache/dubbo-go/remoting/zookeeper" | |||
) | |||
|
|||
// RegistryDataListener ... |
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.
add some comment for this file
return perrors.Errorf("@c{%v} type is not referencer or provider", c) | ||
} | ||
encodedURL = url.QueryEscape(rawURL) | ||
dubboPath = strings.ReplaceAll(dubboPath, "$", "%24") |
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 don't understand why not use url.QueryEscape for dubboPath?
logger.Errorf("facadeBasedRegistry.CreatePath(path{%s}) = error{%#v}", dubboPath, perrors.WithStack(err)) | ||
return "", "", perrors.WithMessagef(err, "facadeBasedRegistry.CreatePath(path:%s)", dubboPath) | ||
} | ||
params.Add("anyhost", "true") |
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.
What does it mean?
|
||
params.Add("side", (common.RoleType(common.PROVIDER)).Role()) | ||
|
||
if len(c.Methods) == 0 { |
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.
if len(c.Methods) != 0 { ...}
????
} | ||
dubboPath = fmt.Sprintf("/dubbo/%s/%s", r.service(c), common.DubboNodes[common.PROVIDER]) | ||
r.cltLock.Lock() | ||
err = r.facadeBasedRegistry.CreatePath(dubboPath) |
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.
Why should we create provider's path here?
|
||
params.Add("protocol", c.Protocol) | ||
params.Add("category", (common.RoleType(common.CONSUMER)).String()) | ||
params.Add("dubbo", "dubbogo-consumer-"+constant.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.
params.Add("dubbo", "dubbo-provider-golang-"+constant.Version)
but here is lack of golang
. Is that right??
|
||
// sleepWait... | ||
func sleepWait(n int) { | ||
wait := time.Duration((n + 1) * 2e8) |
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.
2e8
is hard to understand, please define a constant.
return | ||
} | ||
logger.Warnf("getListener() = err:%v", perrors.WithStack(err)) | ||
time.Sleep(time.Duration(RegistryConnDelay) * time.Second) |
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.
Why not just define the RegistryConnDelay as time.Duration(3* time.Second)
What this PR does:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: