alisaifee/limits

Use redis-py async support instead of coredis

dmarkey opened this issue · 3 comments

Redis-py has has async support for a while, it would be cleaner to use the same library.

Some background:

coredis was actually forked from aredis so that async redis support could be added to limits. aredis was the only single async redis client that had all the features needed to support the various redis topologies supported by limits (sentinel, cluster, etc) at the time - but had gone out of maintenance and did not work with python 3.10+.

In terms of functionality, swapping to redispy would almost be a drop in replacement since the APIs in use aren't too different (I think the only change might be in the use of delete, though I haven't actually tried it).

Specifically with respect to this issue (i.e. "it would be cleaner") could you explain a bit more? i.e. is it because you have both async & sync use of redis in the same code base or that you're already using redis-py async and want to reuse the connection pool or something else?

Some added context, aredis (and thus, coredis) was originally picked instead of aioredis since the latter did not have cluster support. The async implementation in redis-py is adapted from aioredis and the cluster implementation is rather new (added in 4.3). From a quick test it seems like ssl support for cluster (with async) is still under way. I also don't see a way to reuse a connection pool with redis.asyncio.RedisCluster.

Closing due to inactivity