From 28efe303c686597347f559092235303a2fa85f15 Mon Sep 17 00:00:00 2001 From: David Francos Date: Mon, 6 Nov 2023 12:51:16 +0100 Subject: [PATCH] fix: #260 Use from_url instead of specifying manually the config --- redbeat/schedulers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/redbeat/schedulers.py b/redbeat/schedulers.py index fdf13bb..d3b2b4c 100644 --- a/redbeat/schedulers.py +++ b/redbeat/schedulers.py @@ -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)