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

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 { if res.Type() == resp.Error {
return writeErr(res.String()) return writeErr(res.String())