mirror of
https://github.com/redis/redis.git
synced 2026-04-21 03:01:35 -04:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user