mirror of https://github.com/go-redis/redis.git
Added implementation for WAIT command
Reference: https://redis.io/commands/wait
This commit is contained in:
parent
9405576413
commit
6b8c6b3fe9
|
@ -273,6 +273,13 @@ func (c *cmdable) Ping() *StatusCmd {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (c *cmdable) Wait(numSlaves int, timeout time.Duration) *IntCmd {
|
||||
|
||||
cmd := NewIntCmd("wait", numSlaves, int(timeout/time.Second))
|
||||
c.process(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c *cmdable) Quit() *StatusCmd {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
|
|
@ -50,6 +50,13 @@ var _ = Describe("Commands", func() {
|
|||
Expect(ping.Val()).To(Equal("PONG"))
|
||||
})
|
||||
|
||||
It("should Wait", func() {
|
||||
// assume testing on single redis instance
|
||||
wait := client.Wait(0, time.Minute)
|
||||
Expect(wait.Err()).NotTo(HaveOccurred())
|
||||
Expect(wait.Val()).To(Equal(int64(0)))
|
||||
})
|
||||
|
||||
It("should Select", func() {
|
||||
pipe := client.Pipeline()
|
||||
sel := pipe.Select(1)
|
||||
|
|
Loading…
Reference in New Issue