Skip to content

Commit

Permalink
Merge pull request redis#512 from shogo82148/fix-wait-timeout
Browse files Browse the repository at this point in the history
the timeout of WAIT command is in milliseconds.
  • Loading branch information
vmihailenco committed Feb 24, 2017
2 parents c86c141 + 892fb8d commit cbad034
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (c *cmdable) Ping() *StatusCmd {

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)
return cmd
}
Expand Down
4 changes: 3 additions & 1 deletion commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ var _ = Describe("Commands", func() {

It("should Wait", func() {
// 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.Val()).To(Equal(int64(0)))
Expect(time.Now()).To(BeTemporally("~", start.Add(time.Second), 800*time.Millisecond))
})

It("should Select", func() {
Expand Down

0 comments on commit cbad034

Please sign in to comment.