|
17 | 17 | ) |
18 | 18 |
|
19 | 19 | from redis.asyncio.client import ResponseCallbackT |
20 | | -from redis.asyncio.connection import ( |
21 | | - Connection, |
22 | | - DefaultParser, |
23 | | - Encoder, |
24 | | - SSLConnection, |
25 | | - parse_url, |
26 | | -) |
| 20 | +from redis.asyncio.connection import Connection, DefaultParser, SSLConnection, parse_url |
27 | 21 | from redis.asyncio.lock import Lock |
28 | | -from redis.asyncio.parser import CommandsParser |
29 | 22 | from redis.asyncio.retry import Retry |
30 | 23 | from redis.backoff import default_backoff |
31 | 24 | from redis.client import EMPTY_RESPONSE, NEVER_DECODE, AbstractRedis |
|
60 | 53 | TimeoutError, |
61 | 54 | TryAgainError, |
62 | 55 | ) |
| 56 | +from redis.parsers import AsyncCommandsParser, Encoder |
63 | 57 | from redis.typing import AnyKeyT, EncodableT, KeyT |
64 | 58 | from redis.utils import dict_merge, safe_str, str_if_bytes |
65 | 59 |
|
@@ -250,6 +244,7 @@ def __init__( |
250 | 244 | ssl_certfile: Optional[str] = None, |
251 | 245 | ssl_check_hostname: bool = False, |
252 | 246 | ssl_keyfile: Optional[str] = None, |
| 247 | + protocol: Optional[int] = 2, |
253 | 248 | ) -> None: |
254 | 249 | if db: |
255 | 250 | raise RedisClusterException( |
@@ -290,6 +285,7 @@ def __init__( |
290 | 285 | "socket_keepalive_options": socket_keepalive_options, |
291 | 286 | "socket_timeout": socket_timeout, |
292 | 287 | "retry": retry, |
| 288 | + "protocol": protocol, |
293 | 289 | } |
294 | 290 |
|
295 | 291 | if ssl: |
@@ -344,7 +340,7 @@ def __init__( |
344 | 340 | self.cluster_error_retry_attempts = cluster_error_retry_attempts |
345 | 341 | self.connection_error_retry_attempts = connection_error_retry_attempts |
346 | 342 | self.reinitialize_counter = 0 |
347 | | - self.commands_parser = CommandsParser() |
| 343 | + self.commands_parser = AsyncCommandsParser() |
348 | 344 | self.node_flags = self.__class__.NODE_FLAGS.copy() |
349 | 345 | self.command_flags = self.__class__.COMMAND_FLAGS.copy() |
350 | 346 | self.response_callbacks = kwargs["response_callbacks"] |
|
0 commit comments