subsecond sleep option
This commit is contained in:
parent
e3a09d7469
commit
70bdd49acb
@ -130,13 +130,10 @@ func (c *Controller) cmdMassInsert(msg *server.Message) (res resp.Value, err err
|
|||||||
|
|
||||||
func (c *Controller) cmdSleep(msg *server.Message) (res resp.Value, err error) {
|
func (c *Controller) cmdSleep(msg *server.Message) (res resp.Value, err error) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
vs := msg.Values[1:]
|
if len(msg.Values) != 2 {
|
||||||
var sduration string
|
|
||||||
var ok bool
|
|
||||||
if vs, sduration, ok = tokenval(vs); !ok || sduration == "" {
|
|
||||||
return server.NOMessage, errInvalidNumberOfArguments
|
return server.NOMessage, errInvalidNumberOfArguments
|
||||||
}
|
}
|
||||||
d, _ := strconv.Atoi(sduration)
|
d, _ := strconv.ParseFloat(msg.Values[1].String(), 64)
|
||||||
time.Sleep(time.Duration(d) * time.Second)
|
time.Sleep(time.Duration(float64(time.Second) * d))
|
||||||
return server.OKMessage(msg, start), nil
|
return server.OKMessage(msg, start), nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user