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);
}
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);
} 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);