summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-05-05 16:32:53 +0200
committerantirez <antirez@gmail.com>2015-05-05 16:32:53 +0200
commitf7bd816bbbcb5bb944750c10d798b6b9e63e1d3b (patch)
tree4de550749b6fee0d6d9ef79060162c7d4e129d53
parent9f9c44feef1b68bb443270118570c030c04b0085 (diff)
downloadredis-f7bd816bbbcb5bb944750c10d798b6b9e63e1d3b.tar.gz
Don't put clients into unblocked list multiple times
-rw-r--r--src/blocked.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/blocked.c b/src/blocked.c
index 8acfb8184..3442b9dd4 100644
--- a/src/blocked.c
+++ b/src/blocked.c
@@ -137,10 +137,14 @@ void unblockClient(redisClient *c) {
/* Clear the flags, and put the client in the unblocked list so that
* we'll process new commands in its query buffer ASAP. */
c->flags &= ~REDIS_BLOCKED;
- c->flags |= REDIS_UNBLOCKED;
c->btype = REDIS_BLOCKED_NONE;
server.bpop_blocked_clients--;
- listAddNodeTail(server.unblocked_clients,c);
+ /* The client may already be into the unblocked list because of a previous
+ * blocking operation, don't add back it into the list multiple times. */
+ if (!(c->flags & REDIS_UNBLOCKED)) {
+ c->flags |= REDIS_UNBLOCKED;
+ listAddNodeTail(server.unblocked_clients,c);
+ }
}
/* This function gets called when a blocked client timed out in order to