Skip to content

Commit

Permalink
解决 consumer 不断重连已下线的 provider meta service 问题 (#2166)
Browse files Browse the repository at this point in the history
* registry type support all

* fix test

* set default to interface

* use default protocol registry

* fix unit test

* use swith to judge

* add registry support all test

* Resolve registry name conflicts

* fix ut err

* fix #2159

* del front

* del front

Co-authored-by: bobtthp <bobtthp@bob-Mac-mini.local>
Co-authored-by: bob <bob@bobdeMacBook-Pro.local>
Co-authored-by: bobtthp <bobtthp@bob1.local>
Co-authored-by: bob <bob@bob.local>
  • Loading branch information
5 people authored Dec 25, 2022
1 parent 2567655 commit 169a5a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 2 additions & 0 deletions metadata/service/local/service_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ func (m *MetadataServiceProxy) GetMetadataInfo(revision string) (*common.Metadat
invocation.WithAttachments(map[string]interface{}{constant.AsyncKey: "false"}),
invocation.WithParameterValues([]reflect.Value{rV}))
res := m.invkr.Invoke(context.Background(), inv)
// when request finished, invoker will colse
defer m.invkr.Destroy()
if res.Error() != nil {
logger.Errorf("could not get the metadata info from remote provider: %v", res.Error())
return nil, res.Error()
Expand Down
7 changes: 1 addition & 6 deletions metadata/service/local_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,7 @@ func NewBaseMetadataServiceProxyFactory(creator MetadataServiceProxyCreator) *Ba
}

func (b *BaseMetadataServiceProxyFactory) GetProxy(ins registry.ServiceInstance) MetadataService {
key := ins.GetServiceName() + "##" + getExportedServicesRevision(ins)
if proxy, ok := b.proxies.Load(key); ok {
return proxy.(MetadataService)
}
v, _ := b.proxies.LoadOrStore(key, b.creator(ins))
return v.(MetadataService)
return b.creator(ins).(MetadataService)
}

func getExportedServicesRevision(serviceInstance registry.ServiceInstance) string {
Expand Down

0 comments on commit 169a5a0

Please sign in to comment.