Skip to content

Commit

Permalink
优化方法名
Browse files Browse the repository at this point in the history
  • Loading branch information
zengfanwei committed Apr 15, 2021
1 parent c70cb70 commit 8415609
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions common/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ func (c *URL) Key() string {
return buildString
}

//CacheInvokerMapKey get dir cacheInvokerMap key
func (c *URL) CacheInvokerMapKey() string {
//GetCacheInvokerMapKey get directory cacheInvokerMap key
func (c *URL) GetCacheInvokerMapKey() string {
urlNew, _ := NewURL(c.PrimitiveURL)

buildString := fmt.Sprintf("%s://%s:%s@%s:%s/?interface=%s&group=%s&version=%s&timestamp=%s",
Expand Down
6 changes: 3 additions & 3 deletions registry/directory/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (dir *RegistryDirectory) invokerCacheKey(event *registry.ServiceEvent) stri
referenceUrl := dir.GetDirectoryUrl().SubURL
newUrl := common.MergeUrl(event.Service, referenceUrl)
event.Update(newUrl)
return newUrl.CacheInvokerMapKey()
return newUrl.GetCacheInvokerMapKey()
}

// setNewInvokers groups the invokers from the cache first, then set the result to both directory and router chain.
Expand Down Expand Up @@ -325,7 +325,7 @@ func (dir *RegistryDirectory) toGroupInvokers() []protocol.Invoker {

// uncacheInvoker will return abandoned Invoker, if no Invoker to be abandoned, return nil
func (dir *RegistryDirectory) uncacheInvoker(url *common.URL) protocol.Invoker {
return dir.uncacheInvokerWithKey(url.CacheInvokerMapKey())
return dir.uncacheInvokerWithKey(url.GetCacheInvokerMapKey())
}

func (dir *RegistryDirectory) uncacheInvokerWithKey(key string) protocol.Invoker {
Expand Down Expand Up @@ -364,7 +364,7 @@ func (dir *RegistryDirectory) cacheInvoker(url *common.URL) protocol.Invoker {
}

func (dir *RegistryDirectory) doCacheInvoker(newUrl *common.URL) (protocol.Invoker, bool) {
key := newUrl.CacheInvokerMapKey()
key := newUrl.GetCacheInvokerMapKey()
if cacheInvoker, ok := dir.cacheInvokersMap.Load(key); !ok {
logger.Debugf("service will be added in cache invokers: invokers url is %s!", newUrl)
newInvoker := extension.GetProtocol(protocolwrapper.FILTER).Refer(newUrl)
Expand Down
2 changes: 1 addition & 1 deletion registry/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (e *ServiceEvent) Key() string {
if len(e.key) > 0 {
return e.key
}
e.key = e.Service.CacheInvokerMapKey()
e.key = e.Service.GetCacheInvokerMapKey()
return e.key
}

Expand Down

0 comments on commit 8415609

Please sign in to comment.