redis-py icon indicating copy to clipboard operation
redis-py copied to clipboard

Why Async is not actually async?

Open markparonyan opened this issue 7 months ago • 4 comments

line 4074 of redis/commands/core.py (https://github.com/redis/redis-py/blob/8325ce2859b28e61086da904fba6ba87a4ee3d1b/redis/commands/core.py#L4074C1-L4074C37) AsyncStreamCommands = StreamCommands

also this in redismodulecommands line 94: class AsyncRedisModuleCommands(RedisModuleCommands)

and we can go on and on

As I see, if we want asynchronous code, now we need to use redis.asyncio.execute_command method every time, because all wrappers are synchronous (with some exceptions).

Why we don't have asynchronous wrappers?

markparonyan avatar Jun 12 '25 11:06 markparonyan

also as was pointed out here #3569 we don't have async TimeSeries, but the problem is bigger, we don't have async wrappers for most of the features

markparonyan avatar Jun 12 '25 12:06 markparonyan

Hi @markparonyan, the commands execution is asynchronous. What you have noticed is the definition of the commands structure, but when you look in the code - all commands are calling execute_command method, to which the command and its arguments are provided.

The actual implementation of this method is inside the clients.

Synchronous Redis executes the command synchronously(https://github.com/redis/redis-py/blob/master/redis/client.py#L622), asynchronous Redis has its own asynchronous implementation(https://github.com/redis/redis-py/blob/master/redis/asyncio/client.py#L667)

petyaslavova avatar Jun 13 '25 12:06 petyaslavova

Hi @markparonyan, just checking in — did my explanation help clarify things? Let me know if you have any further questions or need more details. Happy to help!

petyaslavova avatar Jun 20 '25 12:06 petyaslavova

@petyaslavova Hi, sorry for the later response. I think you nailed it, thank you! But please don't close the issue yet, I want to look into a few more things in the couple of days. If there will be no questions regarding this topic, I will close this issue

markparonyan avatar Jun 23 '25 15:06 markparonyan

Hi @markparonyan, just checking—can I go ahead and close this issue?

petyaslavova avatar Jul 24 '25 15:07 petyaslavova

@petyaslavova yes, everything is good, thanks for not closing

markparonyan avatar Jul 29 '25 05:07 markparonyan