summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor <igorwwwwwwwwwwwwwwwwwwww@users.noreply.github.com>2021-03-25 15:16:03 +0100
committerOran Agra <oran@redislabs.com>2021-05-03 22:56:49 +0300
commit5c6f0b26c002d957b9c9d0d1037ef85cd27dedd8 (patch)
tree794013d662560a3747008190219650793e65e108
parent8bcca06cb00bd3a80e57a8d08d3666f437642caf (diff)
downloadredis-5c6f0b26c002d957b9c9d0d1037ef85cd27dedd8.tar.gz
Introduce fast path to bypass expensive serveClientsBlockedOnKeyByModule call (#8689)
Introduce fast path to bypass expensive serveClientsBlockedOnKeyByModule call (cherry picked from commit cf0a909e2df02f7f17e173f3cae473f6df7bdff2)
-rw-r--r--src/blocked.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/blocked.c b/src/blocked.c
index 396a71569..460362ceb 100644
--- a/src/blocked.c
+++ b/src/blocked.c
@@ -425,6 +425,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);