mirror of
https://github.com/redis/go-redis.git
synced 2025-08-07 12:42:55 +03:00
Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock * Fix PubSub.Ping to hold the lock * add write cmd data-race test Signed-off-by: monkey92t <golang@88.com> Co-authored-by: monkey92t <golang@88.com>
This commit is contained in:
committed by
GitHub
parent
917c476e75
commit
b94bde306e
12
race_test.go
12
race_test.go
@@ -373,6 +373,18 @@ var _ = Describe("cluster races", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(val).To(Equal(int64(C * N)))
|
||||
})
|
||||
|
||||
It("write cmd data-race", func() {
|
||||
pubsub := client.Subscribe(ctx)
|
||||
defer pubsub.Close()
|
||||
|
||||
pubsub.Channel(redis.WithChannelHealthCheckInterval(time.Millisecond))
|
||||
for i := 0; i < 100; i++ {
|
||||
key := fmt.Sprintf("channel_%d", i)
|
||||
pubsub.Subscribe(ctx, key)
|
||||
pubsub.Unsubscribe(ctx, key)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
func bigVal() []byte {
|
||||
|
Reference in New Issue
Block a user