-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace aioredis with redis-py #151
Conversation
Unfortunately I don't have a redis setup to actually test this thoroughly, so it'd be great if someone else could give it a go. |
Oh, good to know! Let me know once this has been properly tested. I also don't have time for at least a week. :( |
Hi, I came here from #132, I had issues running etesync with a Redis endpoint configured. I have not yet the picture completely clear but I think @tasn is right that the Redis connection was not deeply tested. @Xiretza I've tried your patch and dug a little bit further. I think we cannot yet use the old aioredis connection pool APIs for the time being (see redis-py async client documentation), the merge of I've tried quickly hacking your patch as follows: --- a/etebase_server/fastapi/redis.py
+++ b/etebase_server/fastapi/redis.py
@@ -12,12 +12,11 @@ class RedisWrapper:
async def setup(self):
if self.redis_uri is not None:
- self.redis = await aioredis.create_redis_pool(self.redis_uri)
+ self.redis = await aioredis.from_url(self.redis_uri)
async def close(self):
if hasattr(self, "redis"):
- self.redis.close()
- await self.redis.wait_closed()
+ await self.redis.close() and /at least/ I don't see crashes on startup/shutdown of What do you think? makes sense? That's all I can contribute for the time being, hope it helps! :) |
It's not the end of the world not to use a pool, but it's much much better. |
Actually, I take it back. I think with pub/sub, which we use, it's probably a big deal. |
@tasn to further clarify my previous comment, I just meant that the old aioredis connection pool API is not available and one should probably switch to another one (as per the documentation link). |
Yeah, I understood that @jman-schief, though thanks for the clarification. I just re-emphasized, that I think a pool is needed, or at least the code needs to be changed to reconnect every time (less than ideal). |
OK, it looks like redis-py does indeed support pooling, we just need to slightly change how we create the object (as discussed above). @Xiretza, got time to take a look, or should I see if I can adjust this PR? |
I pushed the adjustments to |
aioredis has been merged into redis-py and will no longer be maintained as a separate project.
@tasn could you make a new release? |
Done! Thanks @victor-rds for the reminder. In my head you're still tracking |
aioredis
has been merged intoredis-py
and will no longer be maintained as a separate project.Fixes #150.