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:Rename 'one' to 'cacheOnce' #2423

Merged
merged 1 commit into from
Sep 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (

var (
metaCache *store.CacheManager
one sync.Once
cacheOnce sync.Once
)

func initCache() {
Expand All @@ -65,7 +65,7 @@ type ServiceInstancesChangedListenerImpl struct {
}

func NewServiceInstancesChangedListener(services *gxset.HashSet) registry.ServiceInstancesChangedListener {
one.Do(initCache)
cacheOnce.Do(initCache)
return &ServiceInstancesChangedListenerImpl{
serviceNames: services,
listeners: make(map[string]registry.NotifyListener),
Expand Down Expand Up @@ -216,7 +216,7 @@ func (lstn *ServiceInstancesChangedListenerImpl) GetEventType() reflect.Type {

// GetMetadataInfo get metadata info when MetadataStorageTypePropertyName is null
func GetMetadataInfo(instance registry.ServiceInstance, revision string) (*common.MetadataInfo, error) {
one.Do(initCache)
cacheOnce.Do(initCache)
if metadataInfo, ok := metaCache.Get(revision); ok {
return metadataInfo.(*common.MetadataInfo), nil
}
Expand Down