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:polaris service discovery cause nil panic #2317

Merged
merged 1 commit into from
May 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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