summaryrefslogtreecommitdiff
path: root/src/blocked.c
diff options
context:
space:
mode:
authorIgor <igorwwwwwwwwwwwwwwwwwwww@users.noreply.github.com>2021-03-25 15:16:03 +0100
committerGitHub <noreply@github.com>2021-03-25 07:16:03 -0700
commitcf0a909e2df02f7f17e173f3cae473f6df7bdff2 (patch)
tree3af6c2b67bdd4fc414f6306dea01c6fc92326e88 /src/blocked.c
parent1976acfe3e40ca2a1b42ffe7f94cfc7487aa2302 (diff)
downloadredis-cf0a909e2df02f7f17e173f3cae473f6df7bdff2.tar.gz
Introduce fast path to bypass expensive serveClientsBlockedOnKeyByModule call (#8689)
Introduce fast path to bypass expensive serveClientsBlockedOnKeyByModule call
Diffstat (limited to 'src/blocked.c')
-rw-r--r--src/blocked.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/blocked.c b/src/blocked.c
index 5f4fa9ec2..179bf3556 100644
--- a/src/blocked.c
+++ b/src/blocked.c
@@ -480,6 +480,10 @@ void serveClientsBlockedOnStreamKey(robj *o, readyList *rl) {
void serveClientsBlockedOnKeyByModule(readyList *rl) {
dictEntry *de;
+ /* Optimization: If no clients are in type BLOCKED_MODULE,
+ * we can skip this loop. */
+ if (!server.blocked_clients_by_type[BLOCKED_MODULE]) return;
+
/* We serve clients in the same order they blocked for
* this key, from the first blocked to the last. */
de = dictFind(rl->db->blocking_keys,rl->key);