1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Fix nil pool on read timeout. Fixes #135.

This commit is contained in:
Vladimir Mihailenco
2015-07-13 13:45:37 +03:00
parent 7baacea8fb
commit 029065eb68
3 changed files with 36 additions and 17 deletions

View File

@ -134,6 +134,20 @@ var _ = Describe("Client", func() {
Expect(db1.FlushDb().Err()).NotTo(HaveOccurred())
})
It("should support DB selection with read timeout (issue #135)", func() {
for i := 0; i < 100; i++ {
db1 := redis.NewClient(&redis.Options{
Addr: redisAddr,
DB: 1,
ReadTimeout: time.Nanosecond,
})
err := db1.Ping().Err()
Expect(err).To(HaveOccurred())
Expect(err.(net.Error).Timeout()).To(BeTrue())
}
})
It("should retry command on network error", func() {
Expect(client.Close()).NotTo(HaveOccurred())