Skip to content

Commit

Permalink
pass sentinel_kwargs to Sentinel() broker (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedaljawahiry authored May 21, 2022
1 parent e50973b commit df35564
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flower/utils/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def __init__(self, broker_url, *args, **kwargs):
self.port = self.port or 26379
self.vhost = self._prepare_virtual_host(self.vhost)
self.master_name = self._prepare_master_name(broker_options)
self.redis = self._get_redis_client()
self.redis = self._get_redis_client(broker_options)

def _prepare_virtual_host(self, vhost):
if not isinstance(vhost, numbers.Integral):
Expand All @@ -194,8 +194,11 @@ def _prepare_master_name(self, broker_options):
)
return master_name

def _get_redis_client(self):
connection_kwargs = {'password': self.password}
def _get_redis_client(self, broker_options):
connection_kwargs = {
'password': self.password,
'sentinel_kwargs': broker_options.get('sentinel_kwargs')
}
# TODO: get all sentinel hosts from Celery App config and use them to initialize Sentinel
sentinel = redis.sentinel.Sentinel(
[(self.host, self.port)], **connection_kwargs)
Expand Down

0 comments on commit df35564

Please sign in to comment.