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 a2b874ab9d
commit 06a92d8a21
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())