Merge pull request from shogo82148/fix-wait-timeout

the timeout of WAIT command is in milliseconds.
This commit is contained in:
Vladimir Mihailenco 2017-02-24 13:01:17 +03:00 committed by GitHub
commit cbad034630
2 changed files with 4 additions and 2 deletions

View File

@ -275,7 +275,7 @@ func (c *cmdable) Ping() *StatusCmd {
func (c *cmdable) Wait(numSlaves int, timeout time.Duration) *IntCmd { func (c *cmdable) Wait(numSlaves int, timeout time.Duration) *IntCmd {
cmd := NewIntCmd("wait", numSlaves, int(timeout/time.Second)) cmd := NewIntCmd("wait", numSlaves, int(timeout/time.Millisecond))
c.process(cmd) c.process(cmd)
return cmd return cmd
} }

View File

@ -52,9 +52,11 @@ var _ = Describe("Commands", func() {
It("should Wait", func() { It("should Wait", func() {
// assume testing on single redis instance // assume testing on single redis instance
wait := client.Wait(0, time.Minute) start := time.Now()
wait := client.Wait(1, time.Second)
Expect(wait.Err()).NotTo(HaveOccurred()) Expect(wait.Err()).NotTo(HaveOccurred())
Expect(wait.Val()).To(Equal(int64(0))) Expect(wait.Val()).To(Equal(int64(0)))
Expect(time.Now()).To(BeTemporally("~", start.Add(time.Second), 800*time.Millisecond))
}) })
It("should Select", func() { It("should Select", func() {