Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
be426b6a
Commit
be426b6a
authored
4 years ago
by
邹毅贤
Browse files
Options
Downloads
Patches
Plain Diff
fix review problems
parent
93351409
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
registry/base_registry.go
+9
-10
9 additions, 10 deletions
registry/base_registry.go
with
9 additions
and
10 deletions
registry/base_registry.go
+
9
−
10
View file @
be426b6a
...
...
@@ -240,7 +240,7 @@ func (r *BaseRegistry) unregister(c common.URL) error {
return
r
.
processURL
(
c
,
r
.
facadeBasedRegistry
.
DoUnregister
,
nil
)
}
func
(
r
*
BaseRegistry
)
processURL
(
c
common
.
URL
,
f
func
(
string
,
string
)
error
,
createPathFunc
func
(
dubboPath
string
)
error
)
error
{
func
(
r
*
BaseRegistry
)
processURL
(
c
common
.
URL
,
f
func
(
string
,
string
)
error
,
cpf
createPathFunc
)
error
{
if
f
==
nil
{
panic
(
" Must provide a `function(string, string) error` to process URL. "
)
}
...
...
@@ -268,9 +268,9 @@ func (r *BaseRegistry) processURL(c common.URL, f func(string, string) error, cr
switch
role
{
case
common
.
PROVIDER
:
dubboPath
,
rawURL
,
err
=
r
.
providerRegistry
(
c
,
params
,
c
reatePathFunc
)
dubboPath
,
rawURL
,
err
=
r
.
providerRegistry
(
c
,
params
,
c
pf
)
case
common
.
CONSUMER
:
dubboPath
,
rawURL
,
err
=
r
.
consumerRegistry
(
c
,
params
,
c
reatePathFunc
)
dubboPath
,
rawURL
,
err
=
r
.
consumerRegistry
(
c
,
params
,
c
pf
)
default
:
return
perrors
.
Errorf
(
"@c{%v} type is not referencer or provider"
,
c
)
}
...
...
@@ -292,7 +292,7 @@ func (r *BaseRegistry) createPath(dubboPath string) error {
}
// providerRegistry for provider role do
func
(
r
*
BaseRegistry
)
providerRegistry
(
c
common
.
URL
,
params
url
.
Values
,
createPathFunc
func
(
dubboPath
string
)
error
)
(
string
,
string
,
error
)
{
func
(
r
*
BaseRegistry
)
providerRegistry
(
c
common
.
URL
,
params
url
.
Values
,
f
createPathFunc
)
(
string
,
string
,
error
)
{
var
(
dubboPath
string
rawURL
string
...
...
@@ -302,8 +302,8 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, createP
return
""
,
""
,
perrors
.
Errorf
(
"conf{Path:%s, Methods:%s}"
,
c
.
Path
,
c
.
Methods
)
}
dubboPath
=
fmt
.
Sprintf
(
"/dubbo/%s/%s"
,
r
.
service
(
c
),
common
.
DubboNodes
[
common
.
PROVIDER
])
if
createPathFunc
!=
nil
{
err
=
createPathFunc
(
dubboPath
)
if
f
!=
nil
{
err
=
f
(
dubboPath
)
}
if
err
!=
nil
{
logger
.
Errorf
(
"facadeBasedRegistry.CreatePath(path{%s}) = error{%#v}"
,
dubboPath
,
perrors
.
WithStack
(
err
))
...
...
@@ -384,7 +384,7 @@ func (r *BaseRegistry) Subscribe(url *common.URL, notifyListener NotifyListener)
n
++
if
!
r
.
IsAvailable
()
{
logger
.
Warnf
(
"event listener game over."
)
return
perrors
.
New
(
"
nacos
Registry is not available."
)
return
perrors
.
New
(
"
Base
Registry is not available."
)
}
listener
,
err
:=
r
.
facadeBasedRegistry
.
DoSubscribe
(
url
)
...
...
@@ -417,17 +417,16 @@ func (r *BaseRegistry) Subscribe(url *common.URL, notifyListener NotifyListener)
func
(
r
*
BaseRegistry
)
UnSubscribe
(
url
*
common
.
URL
,
notifyListener
NotifyListener
)
error
{
if
!
r
.
IsAvailable
()
{
logger
.
Warnf
(
"event listener game over."
)
return
nil
return
perrors
.
New
(
"BaseRegistry is not available."
)
}
listener
,
err
:=
r
.
facadeBasedRegistry
.
DoUnsubscribe
(
url
)
if
err
!=
nil
{
if
!
r
.
IsAvailable
()
{
logger
.
Warnf
(
"event listener game over."
)
return
nil
return
perrors
.
New
(
"BaseRegistry is not available."
)
}
logger
.
Warnf
(
"getListener() = err:%v"
,
perrors
.
WithStack
(
err
))
time
.
Sleep
(
time
.
Duration
(
RegistryConnDelay
)
*
time
.
Second
)
return
perrors
.
WithStack
(
err
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment