Skip to content

Commit

Permalink
fix: sibson#260 Use from_url instead of specifying manually the config
Browse files Browse the repository at this point in the history
  • Loading branch information
XayOn committed Nov 6, 2023
1 parent bd85052 commit 28efe30
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions redbeat/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ def get_redis(app=None):
connection = StrictRedis.from_url(conf.redis_url, decode_responses=True, **ssl_options)
elif conf.redis_url.startswith('redis-cluster'):
from redis.cluster import RedisCluster

if not redis_options.get('startup_nodes'):
redis_options = {'startup_nodes': [{"host": "localhost", "port": "30001"}]}
connection = RedisCluster(decode_responses=True, **redis_options)
connection = RedisCluster.from_url(
conf.redis_url.replace("redis-cluster://", "redis://"),
decode_responses=True,
**redis_options,
)
else:
connection = StrictRedis.from_url(conf.redis_url, decode_responses=True)

Expand Down

0 comments on commit 28efe30

Please sign in to comment.