1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-31 05:04:23 +03:00

ConnPool check fd for bad conns (#1824)

* conncheck for badconn (#1821)

* format imports

* fix ut: pool with badconn

* fix unstable ut: should facilitate failover

* Revert "fix unstable ut: should facilitate failover"

This reverts commit c7eeca2a5c.

* fix test error

Signed-off-by: monkey92t <golang@88.com>

Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: monkey92t <golang@88.com>
This commit is contained in:
do it
2021-07-20 17:23:48 +08:00
committed by GitHub
parent 62fc2c821b
commit 346bfafddd
10 changed files with 204 additions and 18 deletions

View File

@ -6,10 +6,10 @@ import (
"testing"
"time"
"github.com/go-redis/redis/v8/internal/pool"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8/internal/pool"
)
var _ = Describe("ConnPool", func() {
@ -285,6 +285,8 @@ var _ = Describe("conns reaper", func() {
cn.SetUsedAt(time.Now().Add(-2 * idleTimeout))
case "aged":
cn.SetCreatedAt(time.Now().Add(-2 * maxAge))
case "conncheck":
cn.Close()
}
conns = append(conns, cn)
staleConns = append(staleConns, cn)
@ -371,6 +373,7 @@ var _ = Describe("conns reaper", func() {
assert("idle")
assert("aged")
assert("conncheck")
})
var _ = Describe("race", func() {