Skip to content
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

Merged
merged 24 commits into from
Dec 18, 2020

Conversation

cvictory
Copy link
Contributor

#750

1.fix empty ServiceEvent, we should clear all invokers
2.we want to notify the address with complete address list.

…s 2.we want to notify the address with complete address list.
@cvictory cvictory added this to the 1.5.2 milestone Sep 16, 2020
@@ -35,6 +36,9 @@ import (
)

func TestNacosRegistry_Register(t *testing.T) {
if _, err := http.Get("http://console.nacos.io/nacos/"); err != nil {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

for _, event := range events {
// Is the key (url.Key()) of cacheInvokersMap the best way?
Copy link
Member

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.

Comment on lines 253 to 259
if len(events) == 0 {
return
}

event := events[0]
nl.Notify(event)
}
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines -189 to -200
if invokers == nil || len(invokers) == 0 {
return
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why delete this block?

Copy link
Contributor Author

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.

Copy link
Contributor

@hxmhlt hxmhlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@zouyx zouyx left a 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.

@zouyx zouyx modified the milestones: 1.5.2, v1.5.3 Oct 16, 2020
@AlexStocks
Copy link
Contributor

@hequn @lizhixin

@codecov-io
Copy link

codecov-io commented Nov 13, 2020

Codecov Report

Merging #758 (0cb6305) into develop (ab774b5) will decrease coverage by 0.03%.
The diff coverage is 69.44%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
cluster/router/chain/chain.go 68.54% <ø> (-2.09%) ⬇️
registry/nacos/service_discovery.go 64.13% <0.00%> (-0.45%) ⬇️
registry/protocol/protocol.go 76.96% <0.00%> (-0.88%) ⬇️
registry/directory/directory.go 79.72% <75.75%> (+5.71%) ⬆️
config_center/nacos/facade.go 79.31% <0.00%> (-10.35%) ⬇️
metadata/report/delegate/delegate_report.go 29.66% <0.00%> (-9.33%) ⬇️
config_center/nacos/client.go 65.26% <0.00%> (-2.11%) ⬇️
remoting/getty/pool.go 68.72% <0.00%> (-0.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab774b5...0cb6305. Read the comment docs.

// refreshInvokers refreshes service's events.
func (dir *RegistryDirectory) refreshInvokers(event *registry.ServiceEvent) {
if event != nil {
logger.Debugf("refresh invokers with %+v")
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@LaurenceLiZhixin
Copy link
Contributor

LGTM

@zouyx zouyx removed this from the v1.5.5 milestone Dec 11, 2020
@zouyx zouyx modified the milestones: v1.5.5, v1.5.6 Dec 18, 2020
@zouyx zouyx merged commit cfef02a into apache:develop Dec 18, 2020
AlexStocks pushed a commit that referenced this pull request Apr 14, 2021
fix #750.  registry center notify with complete address list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants