Skip to content

Commit 5b23ad8

Browse files
committed
fix bugs.
1 parent 11d5404 commit 5b23ad8

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

cache/cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,13 @@ func (cacheRepository *CacheRepository) CreateWorker(key string, node *gzkwrappe
493493

494494
worker := cacheRepository.nodeStore.GetWorker(key)
495495
if worker != nil {
496-
logger.WARN("[#cache#] %s create worker %s key is already, %s(%s).", node.Location, node.HostName, node.IpAddr)
496+
logger.WARN("[#cache#] %s create worker %s is already, %s(%s).", node.Location, key, node.HostName, node.IpAddr)
497497
return
498498
}
499499

500-
ret := cacheRepository.nodeStore.ContainsLocationWorker(node.Location, node.IpAddr, node.HostName)
500+
ret := cacheRepository.nodeStore.ContainsLocationWorker(node.Location, node.IpAddr)
501501
if ret {
502-
logger.WARN("[#cache#] %s create worker %s ip or host is already, %s(%s).", node.Location, node.HostName, node.IpAddr)
502+
logger.WARN("[#cache#] %s create worker %s ipaddr is already, %s(%s).", node.Location, key, node.HostName, node.IpAddr)
503503
return
504504
}
505505

cache/nodes.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (store *NodeStore) GetWorker(key string) *Worker {
7676
}
7777

7878
//ContainsLocationWorker is exported
79-
func (store *NodeStore) ContainsLocationWorker(location string, ipaddr string, hostname string) bool {
79+
func (store *NodeStore) ContainsLocationWorker(location string, ipaddr string) bool {
8080

8181
store.RLock()
8282
defer store.RUnlock()
@@ -87,11 +87,6 @@ func (store *NodeStore) ContainsLocationWorker(location string, ipaddr string, h
8787
return true
8888
}
8989
}
90-
if itHostName := strings.TrimSpace(worker.Name); itHostName != "" {
91-
if strings.ToUpper(itHostName) == strings.ToUpper(hostname) {
92-
return true
93-
}
94-
}
9590
}
9691
}
9792
return false

0 commit comments

Comments
 (0)