From d38aed4d2b18bba555a2dd8fa17ebf37b8e8fbde Mon Sep 17 00:00:00 2001 From: tidwall Date: Wed, 8 Sep 2021 11:07:07 -0700 Subject: [PATCH] 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. --- internal/server/server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/server/server.go b/internal/server/server.go index 98df3f84..56f84a61 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -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())