Skip to content

Commit f2e3473

Browse files
author
Mike Shchurov
authored
FixingElevated CPU utilization on one node when using RedisCluster pipeline (#1985)
1 parent d56baeb commit f2e3473

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

redis/cluster.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ def pipeline(self, transaction=None, shard_hint=None):
712712

713713
return ClusterPipeline(
714714
nodes_manager=self.nodes_manager,
715+
commands_parser=self.commands_parser,
715716
startup_nodes=self.nodes_manager.startup_nodes,
716717
result_callbacks=self.result_callbacks,
717718
cluster_response_callbacks=self.cluster_response_callbacks,
@@ -1598,6 +1599,7 @@ class ClusterPipeline(RedisCluster):
15981599
def __init__(
15991600
self,
16001601
nodes_manager,
1602+
commands_parser,
16011603
result_callbacks=None,
16021604
cluster_response_callbacks=None,
16031605
startup_nodes=None,
@@ -1610,6 +1612,7 @@ def __init__(
16101612
log.info("Creating new instance of ClusterPipeline")
16111613
self.command_stack = []
16121614
self.nodes_manager = nodes_manager
1615+
self.commands_parser = commands_parser
16131616
self.refresh_table_asap = False
16141617
self.result_callbacks = (
16151618
result_callbacks or self.__class__.RESULT_CALLBACKS.copy()
@@ -1627,11 +1630,6 @@ def __init__(
16271630
kwargs.get("decode_responses", False),
16281631
)
16291632

1630-
# The commands parser refers to the parent
1631-
# so that we don't push the COMMAND command
1632-
# onto the stack
1633-
self.commands_parser = CommandsParser(super())
1634-
16351633
def __repr__(self):
16361634
""" """
16371635
return f"{type(self).__name__}"

0 commit comments

Comments
 (0)