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

Faster renew the subscription

This commit is contained in:
Vladimir Mihailenco
2020-09-05 10:56:09 +03:00
parent 49aac99f9d
commit c357d18624
3 changed files with 20 additions and 13 deletions

View File

@ -70,12 +70,12 @@ var _ = Describe("Sentinel", func() {
return client.Get(ctx, "foo").Err()
}, "15s", "100ms").ShouldNot(HaveOccurred())
// Publish message to check if subscription is renewed.
err = client.Publish(ctx, "foo", "hello").Err()
Expect(err).NotTo(HaveOccurred())
// Check if subscription is renewed.
var msg *redis.Message
Eventually(ch, "15s").Should(Receive(&msg))
Eventually(func() <-chan *redis.Message {
_ = client.Publish(ctx, "foo", "hello").Err()
return ch
}, "15s").Should(Receive(&msg))
Expect(msg.Channel).To(Equal("foo"))
Expect(msg.Payload).To(Equal("hello"))
})