Skip to content

Commit fb10367

Browse files
dvora-hchayim
andauthored
RESP3 response-callbacks cleanup (#2841)
* cluenup * sentinel callbacks * move callbacks * fix async cluster tests * _parsers and import fix in tests * linters * make modules callbacks private * fix async search * fix --------- Co-authored-by: Chayim I. Kirshen <[email protected]>
1 parent f2f8c34 commit fb10367

33 files changed

+1460
-1131
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

redis/_parsers/helpers.py

Lines changed: 851 additions & 0 deletions
Large diffs are not rendered by default.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

redis/asyncio/client.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
cast,
2525
)
2626

27+
from redis._parsers.helpers import (
28+
_RedisCallbacks,
29+
_RedisCallbacksRESP2,
30+
_RedisCallbacksRESP3,
31+
bool_ok,
32+
)
2733
from redis.asyncio.connection import (
2834
Connection,
2935
ConnectionPool,
@@ -37,7 +43,6 @@
3743
NEVER_DECODE,
3844
AbstractRedis,
3945
CaseInsensitiveDict,
40-
bool_ok,
4146
)
4247
from redis.commands import (
4348
AsyncCoreCommands,
@@ -257,12 +262,12 @@ def __init__(
257262
self.single_connection_client = single_connection_client
258263
self.connection: Optional[Connection] = None
259264

260-
self.response_callbacks = CaseInsensitiveDict(self.__class__.RESPONSE_CALLBACKS)
265+
self.response_callbacks = CaseInsensitiveDict(_RedisCallbacks)
261266

262267
if self.connection_pool.connection_kwargs.get("protocol") in ["3", 3]:
263-
self.response_callbacks.update(self.__class__.RESP3_RESPONSE_CALLBACKS)
268+
self.response_callbacks.update(_RedisCallbacksRESP3)
264269
else:
265-
self.response_callbacks.update(self.__class__.RESP2_RESPONSE_CALLBACKS)
270+
self.response_callbacks.update(_RedisCallbacksRESP2)
266271

267272
# If using a single connection client, we need to lock creation-of and use-of
268273
# the client in order to avoid race conditions such as using asyncio.gather

0 commit comments

Comments
 (0)