better logs for ping
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m55s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m55s
This commit is contained in:
@@ -151,30 +151,6 @@ func NewSyncedPool(local *GrainLocalPool, hostname string, discovery Discovery)
|
||||
server.HandleCall(RemoteNegotiate, pool.NegotiateHandler)
|
||||
server.HandleCall(RemoteGrainChanged, pool.GrainOwnerChangeHandler)
|
||||
|
||||
// // TODO FIX THIS, ONLY CLIENT OR SERVER SHOULD PING
|
||||
// go func() {
|
||||
// for {
|
||||
// for range time.Tick(time.Second * 2) {
|
||||
// for _, r := range pool.remotes {
|
||||
// err := DoPing(r)
|
||||
// if err != nil {
|
||||
// r.MissedPings++
|
||||
// log.Printf("Error pinging remote %s: %v\n, missed pings: %d", r.Host, err, r.MissedPings)
|
||||
// if r.MissedPings > 3 {
|
||||
// log.Printf("Removing remote %s\n", r.Host)
|
||||
// go pool.RemoveHost(r)
|
||||
// //pool.remotes = append(pool.remotes[:i], pool.remotes[i+1:]...)
|
||||
|
||||
// }
|
||||
// } else {
|
||||
// r.MissedPings = 0
|
||||
// }
|
||||
// }
|
||||
// connectedRemotes.Set(float64(len(pool.remotes)))
|
||||
// }
|
||||
// }
|
||||
// }()
|
||||
|
||||
if discovery != nil {
|
||||
go func() {
|
||||
time.Sleep(time.Second * 5)
|
||||
@@ -388,7 +364,7 @@ func (h *RemoteHost) Ping() error {
|
||||
|
||||
if err != nil {
|
||||
h.MissedPings++
|
||||
log.Printf("Error pinging remote %s: %v\n, missed pings: %d", h.Host, err, h.MissedPings)
|
||||
log.Printf("Error pinging remote %s, missed pings: %d", h.Host, h.MissedPings)
|
||||
|
||||
} else {
|
||||
h.MissedPings = 0
|
||||
@@ -408,7 +384,7 @@ func (p *SyncedPool) AddRemote(host string) error {
|
||||
_, err = client.Call(Ping, Pong, []byte{})
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Error pinging remote %s: %v\n", host, err)
|
||||
log.Printf("No response from new remote %s", host)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -427,7 +403,7 @@ func (p *SyncedPool) AddRemote(host string) error {
|
||||
time.Sleep(time.Millisecond * 200)
|
||||
err = remote.Ping()
|
||||
if remote.MissedPings > 3 {
|
||||
log.Printf("Error pinging remote %s: %v\n, missed pings: %d", host, err, remote.MissedPings)
|
||||
log.Printf("Removing host, unable to communicate with %s", host)
|
||||
p.RemoveHost(&remote)
|
||||
return
|
||||
}
|
||||
@@ -438,7 +414,7 @@ func (p *SyncedPool) AddRemote(host string) error {
|
||||
go func() {
|
||||
for range client.Errors {
|
||||
if client.ErrorCount > 3 {
|
||||
log.Printf("Error count exceeded, removing remote %s\n", host)
|
||||
log.Printf("Error count exceeded, removing remote %s", host)
|
||||
p.RemoveHost(&remote)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user