From cf0a909e2df02f7f17e173f3cae473f6df7bdff2 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 25 Mar 2021 15:16:03 +0100 Subject: [PATCH] Introduce fast path to bypass expensive serveClientsBlockedOnKeyByModule call (#8689) Introduce fast path to bypass expensive serveClientsBlockedOnKeyByModule call --- src/blocked.c | 4 ++++ 1 file changed, 4 insertions(+) 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);