MCPcopy
hub / github.com/redis/redis-py / monitor

Method monitor

redis/cluster.py:1154–1169  ·  view source on GitHub ↗

Returns a Monitor object for the specified target node. The default cluster node will be selected if no target node was specified. Monitor is useful for handling the MONITOR command to the redis server. next_command() method returns one command from monitor

(self, target_node=None)

Source from the content-addressed store, hash-verified

1152 self.retry = retry
1153
1154 def monitor(self, target_node=None):
1155 """
1156 Returns a Monitor object for the specified target node.
1157 The default cluster node will be selected if no target node was
1158 specified.
1159 Monitor is useful for handling the MONITOR command to the redis server.
1160 next_command() method returns one command from monitor
1161 listen() method yields commands from monitor.
1162 """
1163 if target_node is None:
1164 target_node = self.get_default_node()
1165 if target_node.redis_connection is None:
1166 raise RedisClusterException(
1167 f"Cluster Node {target_node.name} has no redis_connection"
1168 )
1169 return target_node.redis_connection.monitor()
1170
1171 def pubsub(self, node=None, host=None, port=None, **kwargs):
1172 """

Callers

nothing calls this directly

Calls 2

get_default_nodeMethod · 0.95

Tested by

no test coverage detected