retry and better logs
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 31s
Build and Publish / BuildAndDeploy (push) Successful in 2m34s

This commit is contained in:
matst80
2024-11-14 08:27:10 +01:00
parent 7795fc9c39
commit d5bfb87b68

View File

@@ -363,17 +363,23 @@ func (p *SyncedPool) removeLocalGrain(id CartId) {
func (p *SyncedPool) AddRemote(host string) { func (p *SyncedPool) AddRemote(host string) {
_, hasHost := p.remotes[host] _, hasHost := p.remotes[host]
if host == "" || hasHost { if host == "" || hasHost || host == p.Hostname {
return return
} }
// if host == "" || hasHost || host == p.Hostname {
// return
// }
client := NewConnection(fmt.Sprintf("%s:1338", host)) client := NewConnection(fmt.Sprintf("%s:1338", host))
r, err := client.Call(Ping, nil) var r *FrameWithPayload
if err != nil { var err error
log.Printf("Error connecting to remote %s: %s\n", host, err) pings := 3
return for pings >= 0 {
r, err = client.Call(Ping, nil)
if err != nil {
log.Printf("Ping failed when adding %s, trying %d more times\n", host, pings)
pings--
time.Sleep(time.Millisecond * 300)
continue
}
break
} }
log.Printf("Connected to remote %s: %v\n", host, r) log.Printf("Connected to remote %s: %v\n", host, r)