Skip to content

Commit

Permalink
fix: use default redis port when not specified in connection kwargs
Browse files Browse the repository at this point in the history
If a port is not specified explicitly `Redis` uses its default port
instead, and it may not always appear in the connection kwargs.
  • Loading branch information
terencehonles committed Dec 18, 2023
1 parent 1a1cd3b commit 3a786da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django_rq/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def get_scheduler_statistics():
# to handle the possibility of a configuration with multiple redis connections and scheduled
# jobs in more than one of them
queue = get_queue_by_index(index)
connection_kwargs = queue.connection.connection_pool.connection_kwargs
conn_key = f"{connection_kwargs['host']}:{connection_kwargs['port']}/{connection_kwargs.get('db', 0)}"
connection = queue.connection.connection_pool.connection_kwargs
conn_key = f"{connection['host']}:{connection.get('port', 6379)}/{connection.get('db', 0)}"
if conn_key not in schedulers:
try:
scheduler = get_scheduler(config['name'])
Expand Down

0 comments on commit 3a786da

Please sign in to comment.