summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-03-21 09:13:29 +0100
committerantirez <antirez@gmail.com>2015-03-21 18:23:01 +0100
commitc43c970344da846d75a4421dc7936d805765c751 (patch)
treee036dc0e7743e9ba4c1ef8081dc197325ba5980c
parentb64c8611715122b76942dd5571a0016e5dbdd7f9 (diff)
downloadredis-c43c970344da846d75a4421dc7936d805765c751.tar.gz
Net: processUnblockedClients() and clientsArePaused() minor changes.
1. No need to set btype in processUnblockedClients(), since clients flagged REDIS_UNBLOCKED should have it already cleared. 2. When putting clients in the unblocked clients list, clientsArePaused() should flag them with REDIS_UNBLOCKED. Not strictly needed with the current code but is more coherent.
-rw-r--r--src/blocked.c1
-rw-r--r--src/networking.c7
2 files changed, 6 insertions, 2 deletions
diff --git a/src/blocked.c b/src/blocked.c
index 4cd632bd3..8ea2cfc43 100644
--- a/src/blocked.c
+++ b/src/blocked.c
@@ -114,7 +114,6 @@ void processUnblockedClients(void) {
c = ln->value;
listDelNode(server.unblocked_clients,ln);
c->flags &= ~REDIS_UNBLOCKED;
- c->btype = REDIS_BLOCKED_NONE;
/* Process remaining data in the input buffer. */
if (c->querybuf && sdslen(c->querybuf) > 0) {
diff --git a/src/networking.c b/src/networking.c
index 9f55ecf31..33531363f 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -1689,7 +1689,9 @@ void pauseClients(mstime_t end) {
/* Return non-zero if clients are currently paused. As a side effect the
* function checks if the pause time was reached and clear it. */
int clientsArePaused(void) {
- if (server.clients_paused && server.clients_pause_end_time < server.mstime) {
+ if (server.clients_paused &&
+ server.clients_pause_end_time < server.mstime)
+ {
listNode *ln;
listIter li;
redisClient *c;
@@ -1702,7 +1704,10 @@ int clientsArePaused(void) {
while ((ln = listNext(&li)) != NULL) {
c = listNodeValue(ln);
+ /* Don't touch slaves and blocked clients. The latter pending
+ * requests be processed when unblocked. */
if (c->flags & (REDIS_SLAVE|REDIS_BLOCKED)) continue;
+ c->flags |= REDIS_UNBLOCKED;
listAddNodeTail(server.unblocked_clients,c);
}
}