mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +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:
@ -123,7 +123,7 @@ var _ = Describe("Tx", func() {
|
||||
Expect(num).To(Equal(int64(N)))
|
||||
})
|
||||
|
||||
It("should recover from bad connection", func() {
|
||||
It("should remove from bad connection", func() {
|
||||
// Put bad connection in the pool.
|
||||
cn, err := client.Pool().Get(context.Background())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
@ -134,17 +134,14 @@ var _ = Describe("Tx", func() {
|
||||
do := func() error {
|
||||
err := client.Watch(ctx, func(tx *redis.Tx) error {
|
||||
_, err := tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
|
||||
pipe.Ping(ctx)
|
||||
return nil
|
||||
return pipe.Ping(ctx).Err()
|
||||
})
|
||||
return err
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
err = do()
|
||||
Expect(err).To(MatchError("bad connection"))
|
||||
|
||||
// connCheck will automatically remove damaged connections.
|
||||
err = do()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
|
Reference in New Issue
Block a user