-
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
fix #750. registry center notify with complete address list #758
Conversation
…s 2.we want to notify the address with complete address list.
registry/nacos/registry_test.go
Outdated
@@ -35,6 +36,9 @@ import ( | |||
) | |||
|
|||
func TestNacosRegistry_Register(t *testing.T) { | |||
if _, err := http.Get("http://console.nacos.io/nacos/"); err != nil { |
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.
maybe u'd better encapsulate a func to delete duplicate codes.
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.
done
registry/directory/directory.go
Outdated
for _, event := range events { | ||
// Is the key (url.Key()) of cacheInvokersMap the best way? |
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.
this is necessary, we should assume (safely) that all events are UPDATE events, otherwise how would you process DELETE events? plus, per the comment on the interface:
// The argument of events []*ServiceEvent is equal to urls []*URL, because Action of ServiceEvent will be ignored.
3352d96
to
6053327
Compare
registry/protocol/protocol.go
Outdated
if len(events) == 0 { | ||
return | ||
} | ||
|
||
event := events[0] | ||
nl.Notify(event) | ||
} |
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 notify all just get first element?
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.
done
if invokers == nil || len(invokers) == 0 { | ||
return | ||
} |
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 delete this block?
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.
delete empty protection. When the address is empty, the route should be refresh.
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.
LGTM
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.
Merge develop and make Checks to normal.
Codecov Report
@@ Coverage Diff @@
## develop #758 +/- ##
===========================================
- Coverage 60.08% 60.04% -0.04%
===========================================
Files 260 260
Lines 12856 12896 +40
===========================================
+ Hits 7725 7744 +19
- Misses 4167 4185 +18
- Partials 964 967 +3
Continue to review full report at Codecov.
|
registry/directory/directory.go
Outdated
// refreshInvokers refreshes service's events. | ||
func (dir *RegistryDirectory) refreshInvokers(event *registry.ServiceEvent) { | ||
if event != nil { | ||
logger.Debugf("refresh invokers with %+v") |
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.
Event detail may be left in func Debugf
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.
done.
LGTM |
This reverts commit af608d8.
fix #750. registry center notify with complete address list
#750
1.fix empty ServiceEvent, we should clear all invokers
2.we want to notify the address with complete address list.