aioredis-py
aioredis-py copied to clipboard
add RESP3 support
doing await redis.execute(b'HELLO', 3)
raises aioredis.errors.ProtocolError: Protocol error, got "%" as reply type byte
This issue should be resolved as of #891 - please feel free to pull in the latest master and test to ensure this is the case.
Hi @seandstewart - thank you for your work on this library.
I can confirm that, using v.2.0.1, this is not resolved. This results in an InvalidResponse
error:
File /usr/local/Caskroom/miniconda/base/envs/triage-calc/lib/python3.9/site-packages/aioredis/connection.py:406, in PythonParser.read_response(self)
403 byte, response = raw[:1], raw[1:]
405 if byte not in (b"-", b"+", b":", b"$", b"*"):
--> 406 raise InvalidResponse(f"Protocol Error: {raw!r}")
408 # server returned an error
409 if byte == b"-":
InvalidResponse: Protocol Error: b'%7']()
Perhaps this is indeed the correct response, i.e. that the library does not support RESP3, however considering the title of this issue, and the label you assigned to it, one would assume that the library does now support RESP3. I think some clarification is needed.
Thanks.
Hey @peedrr -
Apologies, this was incorrectly triaged. However, the latest hiredis-py has support for all aspects of the RESP3 which are currently in-use, so if you use that library your client will have RESP3 support.
Pure-Python support was added in #1287, but that has a long way to go till it's ready to merge.
I'll re-open this issue in the meantime.
Thanks for the quick response.
Please excuse what might be quite a basic question: I have just reinstalled aioredis using pip install aioredis[hiredis]
. If I run await r.execute_command('HELLO', 3)
I still get the same error. What am I missing here?
If some context helps at all, I am trying to implement Redis server-assisted client-side caching. As I'm sure you know, RESP3 allows for two-way communication between client and server, therefore the invalidate
messages from the server are sent direct and are guaranteed, whereas the RESP2 implementation requires two client connections, with the server -> client communication being done over a Pub/Sub (and therefore with no guarantee of delivery). From what I understand so far, it seems the first step is to promote the client to use RESP3 by issuing the above HELLO
command, and so I can't seem to move beyond this point.
Incidentally, if you know of any resources which might help me to get this working, I would really appreciate some pointers. I don't necessarily require my implementation to be async, therefore any resources which use redis-py would also be useful.
Thanks again.