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

PubSub conns don't share connection pool limit

This commit is contained in:
Vladimir Mihailenco
2017-04-17 15:43:58 +03:00
parent aeb22d6a37
commit 6499563e07
14 changed files with 180 additions and 153 deletions

View File

@ -95,7 +95,7 @@ var _ = Describe("Client", func() {
Expect(client.Close()).NotTo(HaveOccurred())
_, err := pubsub.Receive()
Expect(err).To(HaveOccurred())
Expect(err).To(MatchError("redis: client is closed"))
Expect(pubsub.Close()).NotTo(HaveOccurred())
})
@ -217,6 +217,7 @@ var _ = Describe("Client", func() {
})
var _ = Describe("Client timeout", func() {
var opt *redis.Options
var client *redis.Client
AfterEach(func() {
@ -240,7 +241,13 @@ var _ = Describe("Client timeout", func() {
})
It("Subscribe timeouts", func() {
if opt.WriteTimeout == 0 {
return
}
pubsub := client.Subscribe()
defer pubsub.Close()
err := pubsub.Subscribe("_")
Expect(err).To(HaveOccurred())
Expect(err.(net.Error).Timeout()).To(BeTrue())
@ -269,7 +276,7 @@ var _ = Describe("Client timeout", func() {
Context("read timeout", func() {
BeforeEach(func() {
opt := redisOptions()
opt = redisOptions()
opt.ReadTimeout = time.Nanosecond
opt.WriteTimeout = -1
client = redis.NewClient(opt)
@ -280,7 +287,7 @@ var _ = Describe("Client timeout", func() {
Context("write timeout", func() {
BeforeEach(func() {
opt := redisOptions()
opt = redisOptions()
opt.ReadTimeout = -1
opt.WriteTimeout = time.Nanosecond
client = redis.NewClient(opt)