[VOL-5486] Fix deprecated versions
Change-Id: I3e03ea246020547ae75fa92ce8cf5cbba7e8f3bb
Signed-off-by: Abhay Kumar <abhay.kumar@radisys.com>
diff --git a/vendor/github.com/go-redis/redis/v8/error.go b/vendor/github.com/go-redis/redis/v8/error.go
index 9fe1376..521594b 100644
--- a/vendor/github.com/go-redis/redis/v8/error.go
+++ b/vendor/github.com/go-redis/redis/v8/error.go
@@ -10,6 +10,7 @@
"github.com/go-redis/redis/v8/internal/proto"
)
+// ErrClosed performs any operation on the closed client will return this error.
var ErrClosed = pool.ErrClosed
type Error interface {
@@ -64,15 +65,28 @@
return ok
}
-func isBadConn(err error, allowTimeout bool) bool {
- if err == nil {
+func isBadConn(err error, allowTimeout bool, addr string) bool {
+ switch err {
+ case nil:
return false
+ case context.Canceled, context.DeadlineExceeded:
+ return true
}
if isRedisError(err) {
- // Close connections in read only state in case domain addr is used
- // and domain resolves to a different Redis Server. See #790.
- return isReadOnlyError(err)
+ switch {
+ case isReadOnlyError(err):
+ // Close connections in read only state in case domain addr is used
+ // and domain resolves to a different Redis Server. See #790.
+ return true
+ case isMovedSameConnAddr(err, addr):
+ // Close connections when we are asked to move to the same addr
+ // of the connection. Force a DNS resolution when all connections
+ // of the pool are recycled
+ return true
+ default:
+ return false
+ }
}
if allowTimeout {
@@ -115,6 +129,14 @@
return strings.HasPrefix(err.Error(), "READONLY ")
}
+func isMovedSameConnAddr(err error, addr string) bool {
+ redisError := err.Error()
+ if !strings.HasPrefix(redisError, "MOVED ") {
+ return false
+ }
+ return strings.HasSuffix(redisError, " "+addr)
+}
+
//------------------------------------------------------------------------------
type timeoutError interface {