diff options
author | Gabi Ganam <gabiganam@gmail.com> | 2023-01-08 11:02:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-08 01:02:48 -0800 |
commit | eef29b68a2cd94de1f03aa1b7891af75f5cabae2 (patch) | |
tree | 5e2b51f2cf38c146263b20b2b3071fa99bebd5c3 /src/timeout.c | |
parent | d0cc3de73f91ca79b2343e73e640b40709cfcaf5 (diff) | |
download | redis-eef29b68a2cd94de1f03aa1b7891af75f5cabae2.tar.gz |
Blocking command with a 0.001 seconds timeout blocks indefinitely (#11688)
Any value in the range of [0-1) turns to 0 when being cast from double to long long. This change rounds up instead of down for values that can't be stored precisely as long doubles.
Diffstat (limited to 'src/timeout.c')
-rw-r--r-- | src/timeout.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/timeout.c b/src/timeout.c index b62423a9e..eb971dcdc 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -29,6 +29,8 @@ #include "server.h" #include "cluster.h" +#include <math.h> + /* ========================== Clients timeouts ============================= */ /* Check if this blocked client timedout (does nothing if the client is @@ -175,7 +177,7 @@ int getTimeoutFromObjectOrReply(client *c, robj *object, mstime_t *timeout, int addReplyError(c, "timeout is out of range"); return C_ERR; } - tval = (long long) ftval; + tval = (long long) ceill(ftval); } else { if (getLongLongFromObjectOrReply(c,object,&tval, "timeout is not an integer or out of range") != C_OK) |