Skip to content

Commit 15168b5

Browse files
optimize loops, when discover load is nil. (#3507)
Signed-off-by: zhanluxianshen <[email protected]>
1 parent 2097002 commit 15168b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/registry/discovery/discovery.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ func (d *Discovery) newSelf(zones map[string][]*discoveryInstance) {
113113
}
114114
// diff old nodes
115115
var olds int
116-
for _, n := range nodes {
117-
if node, ok := d.node.Load().([]string); ok {
116+
if node, ok := d.node.Load().([]string); ok {
117+
for _, n := range nodes {
118118
for _, o := range node {
119119
if o == n {
120120
olds++

0 commit comments

Comments
 (0)