retry and better logs
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user