1
0
mirror of https://github.com/fluencelabs/redis synced 2025-03-18 00:20:50 +00:00

fixed a problem with BLPOP timeout of zero, now it blocks forever

This commit is contained in:
antirez 2009-12-29 19:11:05 -05:00
parent f86a74e944
commit 58d976b8e8

@ -901,7 +901,7 @@ static void closeTimedoutClients(void) {
redisLog(REDIS_DEBUG,"Closing idle client");
freeClient(c);
} else if (c->flags & REDIS_BLOCKED) {
if (c->blockingto < now) {
if (c->blockingto != 0 && c->blockingto < now) {
addReply(c,shared.nullbulk);
unblockClient(c);
}
@ -5503,6 +5503,7 @@ static void blockForKey(redisClient *c, robj *key, time_t timeout) {
if (de == NULL) {
int retval;
/* We take a list of clients blocked for a given key */
l = listCreate();
retval = dictAdd(c->db->blockingkeys,key,l);
incrRefCount(key);
@ -5510,6 +5511,7 @@ static void blockForKey(redisClient *c, robj *key, time_t timeout) {
} else {
l = dictGetEntryVal(de);
}
/* Add this client to the list, and mark it as blocked */
listAddNodeTail(l,c);
c->flags |= REDIS_BLOCKED;
aeDeleteFileEvent(server.el,c->fd,AE_READABLE);