Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #672 #687

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion django_rq/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def get_scheduler_statistics():
connection = first_sentinel.connection_pool.connection_kwargs
else:
connection = queue.connection.connection_pool.connection_kwargs
conn_key = f"{connection['host']}:{connection.get('port', 6379)}/{connection.get('db', 0)}"
conn_key = f"{connection.get('host', 'NOHOST')}:{connection.get('port', 6379)}/{connection.get('db', 0)}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I'm not sure why falling back to NOHOST would fix this issue. Care to elaborate on why the Redis connection has no host property?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes of course! First of all this is only for the name of a string key, ie it will just use "NOHOST" instead of the host of the connection. We could display anything we wanted here or even leave it blank, i.e do connection.get('host').

Second, to understand the probem, I am using a unix connection for my redis, something like:

RQ_QUEUES = {
    "default": {
        "URL": "unix:///home/serafeim/example/redis.sock",
        "DB": 0,
        "DEFAULT_TIMEOUT": 360,
    }
}

So there's no 'host' key on my connection dict resulting in an exception when calling connection['host'] !

if conn_key not in schedulers:
try:
scheduler = get_scheduler(config['name'])
Expand Down
Loading