complete rewrite to grpc
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
)
|
||||
|
||||
type DiscardedHost struct {
|
||||
*Connection
|
||||
Host string
|
||||
Tries int
|
||||
}
|
||||
@@ -26,7 +25,7 @@ func (d *DiscardedHostHandler) run() {
|
||||
d.mu.RLock()
|
||||
lst := make([]*DiscardedHost, 0, len(d.hosts))
|
||||
for _, host := range d.hosts {
|
||||
if host.Tries >= 0 || host.Tries < 5 {
|
||||
if host.Tries >= 0 && host.Tries < 5 {
|
||||
go d.testConnection(host)
|
||||
lst = append(lst, host)
|
||||
} else {
|
||||
@@ -49,7 +48,9 @@ func (d *DiscardedHostHandler) testConnection(host *DiscardedHost) {
|
||||
|
||||
if err != nil {
|
||||
host.Tries++
|
||||
host.Tries = -1
|
||||
if host.Tries >= 5 {
|
||||
// Exceeded retry threshold; will be dropped by run loop.
|
||||
}
|
||||
} else {
|
||||
conn.Close()
|
||||
if d.onConnection != nil {
|
||||
|
||||
Reference in New Issue
Block a user