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

fix: improve pipelines retry logic (#2232)

* fix: improve pipelines retry logic
This commit is contained in:
Vladimir Mihailenco
2022-10-06 14:05:55 +03:00
committed by GitHub
parent 6327c52e60
commit dd9a200427
4 changed files with 96 additions and 125 deletions

View File

@ -2,7 +2,6 @@ package redis_test
import (
"bytes"
"context"
"fmt"
"net"
"strconv"
@ -289,26 +288,6 @@ var _ = Describe("races", func() {
wg.Wait()
Expect(atomic.LoadUint32(&received)).To(Equal(uint32(C * N)))
})
It("should abort on context timeout", func() {
opt := redisClusterOptions()
client := cluster.newClusterClient(ctx, opt)
ctx, cancel := context.WithCancel(context.Background())
wg := performAsync(C, func(_ int) {
_, err := client.XRead(ctx, &redis.XReadArgs{
Streams: []string{"test", "$"},
Block: 1 * time.Second,
}).Result()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Or(Equal(context.Canceled.Error()), ContainSubstring("operation was canceled")))
})
time.Sleep(10 * time.Millisecond)
cancel()
wg.Wait()
})
})
var _ = Describe("cluster races", func() {