missing updates #5
@@ -144,8 +144,17 @@ func (p *SimpleGrainPool[V]) TakeOwnership(id uint64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *SimpleGrainPool[V]) AddRemote(host string) (Host, error) {
|
func (p *SimpleGrainPool[V]) AddRemote(host string) (Host, error) {
|
||||||
if host == "" || host == p.hostname || p.IsKnown(host) {
|
if host == "" {
|
||||||
return nil, fmt.Errorf("invalid host")
|
return nil, fmt.Errorf("host is empty")
|
||||||
|
}
|
||||||
|
if host == p.hostname {
|
||||||
|
return nil, fmt.Errorf("same host, this should not happen")
|
||||||
|
}
|
||||||
|
p.remoteMu.RLock()
|
||||||
|
existing, found := p.remoteHosts[host]
|
||||||
|
p.remoteMu.RUnlock()
|
||||||
|
if found {
|
||||||
|
return existing, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
remote, err := p.spawnHost(host)
|
remote, err := p.spawnHost(host)
|
||||||
|
|||||||
Reference in New Issue
Block a user