lobj = lookupKeyWrite(c->db,c->argv[1]);
if (lobj == NULL) {
- if (handleClientsWaitingListPush(c,c->argv[1],c->argv[2])) return;
+ if (handleClientsWaitingListPush(c,c->argv[1],c->argv[2])) {
+ addReply(c,shared.ok);
+ return;
+ }
lobj = createListObject();
list = lobj->ptr;
if (where == REDIS_HEAD) {
addReply(c,shared.wrongtypeerr);
return;
}
- if (handleClientsWaitingListPush(c,c->argv[1],c->argv[2])) return;
+ if (handleClientsWaitingListPush(c,c->argv[1],c->argv[2])) {
+ addReply(c,shared.ok);
+ return;
+ }
list = lobj->ptr;
if (where == REDIS_HEAD) {
listAddNodeHead(list,c->argv[2]);
* empty we need to block. In order to do so we remove the notification for
* new data to read in the client socket (so that we'll not serve new
* requests if the blocking request is not served). Also we put the client
- * in a dictionary (server.blockingkeys) mapping keys to a list of clients
+ * in a dictionary (db->blockingkeys) mapping keys to a list of clients
* blocking for this keys.
* - If a PUSH operation against a key with blocked clients waiting is
* performed, we serve the first in the list: basically instead to push
dictEntry *de;
list *l;
- printf("blockForKey %p %s\n", c, key->ptr);
c->blockingkey = key;
incrRefCount(key);
c->blockingto = timeout;
dictEntry *de;
list *l;
- printf("unblockClient %p %s\n", c, c->blockingkey->ptr);
/* Remove this client from the list of clients waiting for this key. */
assert(c->blockingkey != NULL);
de = dictFind(c->db->blockingkeys,c->blockingkey);
ln = listFirst(l);
assert(ln != NULL);
receiver = ln->value;
- listDelNode(l,ln);
- if (listLength(l) == 0)
- dictDelete(c->db->blockingkeys,key);
addReplyBulkLen(receiver,ele);
addReply(receiver,ele);