django-redis
django-redis copied to clipboard
Use Existing Connection Pool
Hi guys,
i wanted to ask if there is the option to use an existing connection pool? I have redis-py already in place for huey and would love to pass in my SentinelConnectionPool to django-redis as well. So I need to define it once and can share it across all redis dependend clients.
e.g. this is how it looks for huey
'connection': {
'connection_pool': SentinelConnectionPool(service_name="mymaster",
sentinel_manager=sentinel.Sentinel([("localhost",26379)],
password="XXXXXXX",
socket_timeout=10,
sentinel_kwargs={"password": "XXXXX"})
),
},
IIRC that's not "exactly" supported by default, but making a trivial connection factory would be the way to do it https://github.com/jazzband/django-redis#customize-connection-factory
Hello @ZuSe!
Maybe the new feature added by @terencehonles supporting sentinel is what you are looking for?
I guess I didn't quite think of that :sweat_smile: . If the question is to use a redis sentinel I did contribute a connection factory recently that would likely work. If you did indeed want to use an existing pool or connection you'd need to use the connection factory as I suggested since the connection factory will create new connections and will need to be passed the same arguments you use for huey.
@ZuSe has your question been answered or you are looking for something else?
Just asking so that we could close this issue.
Might it make sense to enable a stale bot to auto close issues like this? I'm not sure if we've been given permissions to install anything like that though :thinking: since I think we're still waiting on a number of things for "full" jazzband membership and I don't know if the org is set up to allow that every :confused:
@ZuSe has your question been answered or you are looking for something else?
Just asking so that we could close this issue.
Hi @WisdomPill
yes, it's kinda answered. Now, the question would be more how you you guys think about providing Connection"-Pools from redis.py right away, but I think that can be discussed in another issue
@terencehonles Could you maybe share ur connection factory? :)
Best
@WisdomPill is referring to the one that was merged in with https://github.com/jazzband/django-redis/pull/460