1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-02-05 13:15:11 +02:00

fix net error (#2460)

This commit is contained in:
Tony Chen 2022-10-18 21:36:06 +08:00 committed by GitHub
parent 40300677ee
commit 185aaa7184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import (
"container/list"
"context"
"math"
"net"
"sync"
"sync/atomic"
"time"
@ -158,8 +159,9 @@ func (n *Node) Pick() selector.DoneFunc {
if n.errHandler != nil && n.errHandler(di.Err) {
success = 0
}
var netErr net.Error
if errors.Is(context.DeadlineExceeded, di.Err) || errors.Is(context.Canceled, di.Err) ||
errors.IsServiceUnavailable(di.Err) || errors.IsGatewayTimeout(di.Err) {
errors.IsServiceUnavailable(di.Err) || errors.IsGatewayTimeout(di.Err) || errors.As(di.Err, netErr) {
success = 0
}
}