Update simple_grain_pool.go
All checks were successful
Build and Publish / Metadata (push) Successful in 9s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m25s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m8s

This commit is contained in:
matst80
2025-10-13 22:50:09 +02:00
parent 5c67579464
commit 67b9a739fe

View File

@@ -144,8 +144,17 @@ func (p *SimpleGrainPool[V]) TakeOwnership(id uint64) {
}
func (p *SimpleGrainPool[V]) AddRemote(host string) (Host, error) {
if host == "" || host == p.hostname || p.IsKnown(host) {
return nil, fmt.Errorf("invalid host")
if 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)