gateway: throttle  logging when dispatcher is down
Instead of printing every error when draining the connection check for
EOF. If it's EOF the dispatcher is down so sending will also fail and we
don't log anything because the sending will log an error.
package pathhealth
import (
+ "errors"
+ "io"
"net"
"sync"
"time"
@@ -232,6 +234,11 @@ func (m *Monitor) drainConn() {
if closing() {
return
}
+ if errors.Is(err, io.EOF) {
+ // dispatcher is currently down so back off.
+ time.Sleep(500 * time.Millisecond)
+ continue
+ }
if err != nil {
opErr, ok := err.(*snet.OpError)
if ok {
