Skip to content

Commit

Permalink
fix:polaris service discovery cause nil panic
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun committed May 29, 2023
1 parent 9cf1b9f commit fd9aa7b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions registry/polaris/service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fd9aa7b

Please sign in to comment.