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
29415180
Commit
29415180
authored
5 years ago
by
AlexStocks
Browse files
Options
Downloads
Patches
Plain Diff
Fix: do not copy sync.Map
parent
1f378d2d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
common/config/environment.go
+13
-4
13 additions, 4 deletions
common/config/environment.go
config/registry_config.go
+2
-2
2 additions, 2 deletions
config/registry_config.go
remoting/zookeeper/listener.go
+3
-3
3 additions, 3 deletions
remoting/zookeeper/listener.go
with
18 additions
and
9 deletions
common/config/environment.go
+
13
−
4
View file @
29415180
...
...
@@ -63,32 +63,40 @@ func (env *Environment) UpdateExternalConfigMap(externalMap map[string]string) {
func
(
env
*
Environment
)
Configuration
()
*
list
.
List
{
list
:=
list
.
New
()
memConf
:=
newInmemoryConfiguration
()
memConf
.
setProperties
(
env
.
externalConfigMap
)
memConf
.
setProperties
(
&
(
env
.
externalConfigMap
)
)
list
.
PushBack
(
memConf
)
return
list
}
type
InmemoryConfiguration
struct
{
store
sync
.
Map
store
*
sync
.
Map
}
func
newInmemoryConfiguration
()
*
InmemoryConfiguration
{
return
&
InmemoryConfiguration
{}
}
func
(
conf
*
InmemoryConfiguration
)
setProperties
(
p
sync
.
Map
)
{
func
(
conf
*
InmemoryConfiguration
)
setProperties
(
p
*
sync
.
Map
)
{
conf
.
store
=
p
}
func
(
conf
*
InmemoryConfiguration
)
GetProperty
(
key
string
)
(
bool
,
string
)
{
if
conf
.
store
==
nil
{
return
false
,
""
}
v
,
ok
:=
conf
.
store
.
Load
(
key
)
if
ok
{
return
true
,
v
.
(
string
)
}
return
false
,
""
return
false
,
""
}
func
(
conf
*
InmemoryConfiguration
)
GetSubProperty
(
subKey
string
)
map
[
string
]
struct
{}
{
if
conf
.
store
==
nil
{
return
nil
}
properties
:=
make
(
map
[
string
]
struct
{})
conf
.
store
.
Range
(
func
(
key
,
value
interface
{})
bool
{
if
idx
:=
strings
.
Index
(
key
.
(
string
),
subKey
);
idx
>=
0
{
...
...
@@ -100,5 +108,6 @@ func (conf *InmemoryConfiguration) GetSubProperty(subKey string) map[string]stru
}
return
true
})
return
properties
}
This diff is collapsed.
Click to expand it.
config/registry_config.go
+
2
−
2
View file @
29415180
...
...
@@ -37,8 +37,8 @@ type RegistryConfig struct {
Group
string
`yaml:"group" json:"group,omitempty" property:"group"`
//for registry
Address
string
`yaml:"address" json:"address,omitempty" property:"address"`
Username
string
`yaml:"username" json:"
address
,omitempty" property:"username"`
Password
string
`yaml:"password" json:"
address
,omitempty" property:"password"`
Username
string
`yaml:"username" json:"
username
,omitempty" property:"username"`
Password
string
`yaml:"password" json:"
password
,omitempty" property:"password"`
}
func
(
*
RegistryConfig
)
Prefix
()
string
{
...
...
This diff is collapsed.
Click to expand it.
remoting/zookeeper/listener.go
+
3
−
3
View file @
29415180
...
...
@@ -129,14 +129,14 @@ func (l *ZkEventListener) handleZkNodeEvent(zkPath string, children []string, li
continue
}
// listen l service node
go
func
(
node
string
)
{
go
func
(
node
,
childNode
string
)
{
logger
.
Infof
(
"delete zkNode{%s}"
,
node
)
if
l
.
ListenServiceNodeEvent
(
node
,
listener
)
{
logger
.
Infof
(
"delete content{%s}"
,
n
)
logger
.
Infof
(
"delete content{%s}"
,
childNode
)
listener
.
DataChange
(
remoting
.
Event
{
Path
:
zkPath
,
Action
:
remoting
.
EventTypeDel
})
}
logger
.
Warnf
(
"listenSelf(zk path{%s}) goroutine exit now"
,
zkPath
)
}(
newNode
)
}(
newNode
,
n
)
}
// old node was deleted
...
...
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