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(kratos/registry/registry.go): Kratos's ServiceInstance does not i… #2575

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

shima-park
Copy link
Contributor

@shima-park shima-park commented Dec 12, 2022

Kratos's ServiceInstance does not implement an Equal method for grpc's Attributes.

Description (what this PR does / why we need it):
It will help the grpc resolver to work correctly.
If we don't do this, the grpc resolver cannot correctly determine whether the node already exists, and every time the service discovery generates an event, it will establish a connection with all the nodes in the event and release the previously existing node even if it is in the new event exists in.

resolver.go
balancer.go
map.go
resolver.go
attributes.go

Which issue(s) this PR fixes (resolves / be part of):

Other special notes for the reviewers:

Description (what this PR does / why we need it):

Which issue(s) this PR fixes (resolves / be part of):

Other special notes for the reviewers:

…mplement an Equal method for grpc's Attributes.

Description (what this PR does / why we need it):
It will help the grpc resolver to work correctly.
If we don't do this, because the grpc parser cannot correctly determine whether the node already exists, and every time the service discovery generates an event, it will establish a connection with all the nodes in the event and release the previously existing node even if it is in the new event exists in.

[resolver.go](https://github.com/go-kratos/kratos/blob/b3eff576ce0d5cbadf53ec2a9ab1232d45e5cef3/transport/grpc/resolver/discovery/resolver.go#L70)
[balancer.go](https://github.com/grpc/grpc-go/blob/master/balancer/base/balancer.go#L106)
[map.go](https://github.com/grpc/grpc-go/blob/master/resolver/map.go#L60)
[resolver.go](https://github.com/grpc/grpc-go/blob/master/resolver/resolver.go#L143)
[attributes.go](https://github.com/grpc/grpc-go/blob/master/attributes/attributes.go#L91)

Which issue(s) this PR fixes (resolves / be part of):

Other special notes for the reviewers:
@codecov-commenter
Copy link

Codecov Report

Merging #2575 (a3674c9) into main (3d322fe) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2575   +/-   ##
=======================================
  Coverage   85.16%   85.16%           
=======================================
  Files          88       88           
  Lines        3835     3835           
=======================================
  Hits         3266     3266           
  Misses        396      396           
  Partials      173      173           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Sponsor Member

@shenqidebaozi shenqidebaozi left a comment

Choose a reason for hiding this comment

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

LGTM

@shenqidebaozi shenqidebaozi merged commit facafba into go-kratos:main Dec 16, 2022
xiongpan828 pushed a commit to xiongpan828/kratos that referenced this pull request Jan 5, 2023
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.

None yet

4 participants