Skip to content

Commit ec51a38

Browse files
async_cluster: update cleanup_kwargs with kwargs from async Connection
1 parent edd329e commit ec51a38

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

redis/asyncio/cluster.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
SLOT_ID,
1717
AbstractRedisCluster,
1818
LoadBalancer,
19-
cleanup_kwargs,
2019
get_node_name,
2120
parse_cluster_slots,
2221
)
@@ -45,6 +44,33 @@
4544
"TargetNodesT", str, "ClusterNode", List["ClusterNode"], Dict[Any, "ClusterNode"]
4645
)
4746

47+
CONNECTION_ALLOWED_KEYS = (
48+
"client_name",
49+
"db",
50+
"decode_responses",
51+
"encoder_class",
52+
"encoding",
53+
"encoding_errors",
54+
"health_check_interval",
55+
"parser_class",
56+
"password",
57+
"redis_connect_func",
58+
"retry",
59+
"retry_on_timeout",
60+
"socket_connect_timeout",
61+
"socket_keepalive",
62+
"socket_keepalive_options",
63+
"socket_read_size",
64+
"socket_timeout",
65+
"socket_type",
66+
"username",
67+
)
68+
69+
70+
def cleanup_kwargs(**kwargs: Any) -> Dict[str, Any]:
71+
"""Remove unsupported or disabled keys from kwargs."""
72+
return {k: v for k, v in kwargs.items() if k in CONNECTION_ALLOWED_KEYS}
73+
4874

4975
class ClusterParser(DefaultParser):
5076
EXCEPTION_CLASSES = dict_merge(

0 commit comments

Comments
 (0)