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

multi: fix recovering from bad connection.

This commit is contained in:
Vladimir Mihailenco
2015-11-14 14:44:16 +02:00
parent 470271c81e
commit ade3425870
12 changed files with 108 additions and 51 deletions

View File

@ -107,7 +107,7 @@ var _ = Describe("pool", func() {
})
It("should remove broken connections", func() {
cn, err := client.Pool().Get()
cn, _, err := client.Pool().Get()
Expect(err).NotTo(HaveOccurred())
Expect(cn.Close()).NotTo(HaveOccurred())
Expect(client.Pool().Put(cn)).NotTo(HaveOccurred())
@ -141,12 +141,12 @@ var _ = Describe("pool", func() {
pool := client.Pool()
// Reserve one connection.
cn, err := client.Pool().Get()
cn, _, err := client.Pool().Get()
Expect(err).NotTo(HaveOccurred())
// Reserve the rest of connections.
for i := 0; i < 9; i++ {
_, err := client.Pool().Get()
_, _, err := client.Pool().Get()
Expect(err).NotTo(HaveOccurred())
}
@ -191,7 +191,7 @@ func BenchmarkPool(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
conn, err := pool.Get()
conn, _, err := pool.Get()
if err != nil {
b.Fatalf("no error expected on pool.Get but received: %s", err.Error())
}