This is an automated email from the ASF dual-hosted git repository.

justxuewei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/main by this push:
     new cbcfdb4f0 fix:polaris service discovery cause nil panic (#2317)
cbcfdb4f0 is described below

commit cbcfdb4f0c274ffb9e6a81a0db1bb8ae622b8a3e
Author: liaochuntao <liaochun...@live.com>
AuthorDate: Wed May 31 12:17:41 2023 +0800

    fix:polaris service discovery cause nil panic (#2317)
---
 registry/polaris/service_discovery.go | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/registry/polaris/service_discovery.go 
b/registry/polaris/service_discovery.go
index 4bd3e0144..81398ce2c 100644
--- a/registry/polaris/service_discovery.go
+++ b/registry/polaris/service_discovery.go
@@ -79,11 +79,10 @@ func newPolarisServiceDiscovery(url *common.URL) 
(registry.ServiceDiscovery, err
        newInstance := &polarisServiceDiscovery{
                namespace:         
discoveryURL.GetParam(constant.RegistryNamespaceKey, 
constant.PolarisDefaultNamespace),
                descriptor:        descriptor,
-               instanceLock:      &sync.RWMutex{},
                consumer:          consumerApi,
                provider:          providerApi,
+               services:          gxset.NewSet(),
                registryInstances: make(map[string]*PolarisInstanceInfo),
-               listenerLock:      &sync.RWMutex{},
                watchers:          make(map[string]*PolarisServiceWatcher),
        }
        return newInstance, nil
@@ -95,10 +94,10 @@ type polarisServiceDiscovery struct {
        provider          api.ProviderAPI
        consumer          api.ConsumerAPI
        services          *gxset.HashSet
-       instanceLock      *sync.RWMutex
+       instanceLock      sync.RWMutex
        registryInstances map[string]*PolarisInstanceInfo
        watchers          map[string]*PolarisServiceWatcher
-       listenerLock      *sync.RWMutex
+       listenerLock      sync.RWMutex
 }
 
 // Destroy destroy polarisServiceDiscovery, will do unregister all 
ServiceInstance

Reply via email to