mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
fix: handle panic in ringShards Hash function when Ring got closed
Fixes #2126
This commit is contained in:
15
ring_test.go
15
ring_test.go
@ -114,6 +114,21 @@ var _ = Describe("Redis Ring", func() {
|
||||
})
|
||||
|
||||
Describe("pipeline", func() {
|
||||
It("doesn't panic closed ring, returns error", func() {
|
||||
pipe := ring.Pipeline()
|
||||
for i := 0; i < 3; i++ {
|
||||
err := pipe.Set(ctx, fmt.Sprintf("key%d", i), "value", 0).Err()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
|
||||
Expect(ring.Close()).NotTo(HaveOccurred())
|
||||
|
||||
Expect(func() {
|
||||
_, execErr := pipe.Exec(ctx)
|
||||
Expect(execErr).To(HaveOccurred())
|
||||
}).NotTo(Panic())
|
||||
})
|
||||
|
||||
It("distributes keys", func() {
|
||||
pipe := ring.Pipeline()
|
||||
for i := 0; i < 100; i++ {
|
||||
|
Reference in New Issue
Block a user