forked from mirror/redis
Add ClientPause command.
This commit is contained in:
parent
44a58ef067
commit
4df8b2bbbc
|
@ -1114,6 +1114,13 @@ func (c *commandable) ClientList() *StringCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *commandable) ClientPause(dur time.Duration) *BoolCmd {
|
||||||
|
cmd := NewBoolCmd("CLIENT", "PAUSE", formatMs(dur))
|
||||||
|
cmd._clusterKeyPos = 0
|
||||||
|
c.Process(cmd)
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
func (c *commandable) ConfigGet(parameter string) *SliceCmd {
|
func (c *commandable) ConfigGet(parameter string) *SliceCmd {
|
||||||
cmd := NewSliceCmd("CONFIG", "GET", parameter)
|
cmd := NewSliceCmd("CONFIG", "GET", parameter)
|
||||||
cmd._clusterKeyPos = 0
|
cmd._clusterKeyPos = 0
|
||||||
|
|
|
@ -18,8 +18,10 @@ var _ = Describe("Commands", func() {
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
client = redis.NewClient(&redis.Options{
|
client = redis.NewClient(&redis.Options{
|
||||||
Addr: redisAddr,
|
Addr: redisAddr,
|
||||||
PoolTimeout: 30 * time.Second,
|
ReadTimeout: 100 * time.Millisecond,
|
||||||
|
WriteTimeout: 100 * time.Millisecond,
|
||||||
|
PoolTimeout: 30 * time.Second,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -75,6 +77,19 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(r.Val()).To(Equal(""))
|
Expect(r.Val()).To(Equal(""))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should ClientPause", func() {
|
||||||
|
err := client.ClientPause(time.Second).Err()
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
Consistently(func() error {
|
||||||
|
return client.Ping().Err()
|
||||||
|
}, "500ms").Should(HaveOccurred())
|
||||||
|
|
||||||
|
Eventually(func() error {
|
||||||
|
return client.Ping().Err()
|
||||||
|
}, "1s").ShouldNot(HaveOccurred())
|
||||||
|
})
|
||||||
|
|
||||||
It("should ConfigGet", func() {
|
It("should ConfigGet", func() {
|
||||||
r := client.ConfigGet("*")
|
r := client.ConfigGet("*")
|
||||||
Expect(r.Err()).NotTo(HaveOccurred())
|
Expect(r.Err()).NotTo(HaveOccurred())
|
||||||
|
|
Loading…
Reference in New Issue