Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
58d976b8
Commit
58d976b8
authored
Dec 29, 2009
by
antirez
Browse files
fixed a problem with BLPOP timeout of zero, now it blocks forever
parent
f86a74e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
58d976b8
...
@@ -901,7 +901,7 @@ static void closeTimedoutClients(void) {
...
@@ -901,7 +901,7 @@ static void closeTimedoutClients(void) {
redisLog(REDIS_DEBUG,"Closing idle client");
redisLog(REDIS_DEBUG,"Closing idle client");
freeClient(c);
freeClient(c);
} else if (c->flags & REDIS_BLOCKED) {
} else if (c->flags & REDIS_BLOCKED) {
if (c->blockingto < now) {
if (c->blockingto
!= 0 && c->blockingto
< now) {
addReply(c,shared.nullbulk);
addReply(c,shared.nullbulk);
unblockClient(c);
unblockClient(c);
}
}
...
@@ -5503,6 +5503,7 @@ static void blockForKey(redisClient *c, robj *key, time_t timeout) {
...
@@ -5503,6 +5503,7 @@ static void blockForKey(redisClient *c, robj *key, time_t timeout) {
if (de == NULL) {
if (de == NULL) {
int retval;
int retval;
/* We take a list of clients blocked for a given key */
l = listCreate();
l = listCreate();
retval = dictAdd(c->db->blockingkeys,key,l);
retval = dictAdd(c->db->blockingkeys,key,l);
incrRefCount(key);
incrRefCount(key);
...
@@ -5510,6 +5511,7 @@ static void blockForKey(redisClient *c, robj *key, time_t timeout) {
...
@@ -5510,6 +5511,7 @@ static void blockForKey(redisClient *c, robj *key, time_t timeout) {
} else {
} else {
l = dictGetEntryVal(de);
l = dictGetEntryVal(de);
}
}
/* Add this client to the list, and mark it as blocked */
listAddNodeTail(l,c);
listAddNodeTail(l,c);
c->flags |= REDIS_BLOCKED;
c->flags |= REDIS_BLOCKED;
aeDeleteFileEvent(server.el,c->fd,AE_READABLE);
aeDeleteFileEvent(server.el,c->fd,AE_READABLE);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment