Increase the precision of TIMEOUT

This commit ensures that the TIMEOUT is always checked prior to
returning data to the client, and that the elapsed command time
cannot be greater than the timeout value.
This commit is contained in:
tidwall 2021-09-08 11:07:07 -07:00
parent 81ed3e05ed
commit d38aed4d2b
1 changed files with 5 additions and 1 deletions

View File

@ -965,7 +965,11 @@ func (server *Server) handleInputCommand(client *Client, msg *Message) error {
}
}()
}
return server.command(msg, client)
res, d, err = server.command(msg, client)
if msg.Deadline != nil {
msg.Deadline.Check()
}
return res, d, err
}()
if res.Type() == resp.Error {
return writeErr(res.String())