JeremyE
JeremyE

Reputation: 1418

Running into Redis Connection error when adding a second queue to django-RQ

This issue is most likely because of my misunderstanding of how django-RQ/redis works. I've been using django-rq with great results to run/cache long running processes. However, we're now in a position where we need to split up some of these processes into different queues.

The docs make this seem easy enough. However, I get the following error when trying to send a task to the pro queue: Could not resolve a Redis connection I was thinking it was possibly because I'm using the same connection info for both queues, but I've seen other examples that do the same thing (https://newbedev.com/how-to-create-multiple-workers-in-python-rq).

Where did I go wrong? (I included the local and heroku settings as the same issue exists in both).

if(on_heroku): 
    RQ_QUEUES = {
        'default': {
            'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379/0'), # If you're on Heroku
            'DEFAULT_TIMEOUT': 500,
        },
        'pro': {
            'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379/0'), # If you're on Heroku
            'DEFAULT_TIMEOUT': 500,
        }
    }
else:
    RQ_QUEUES = {
        'default': {
            'HOST': 'localhost',
            'PORT': 6379,
            'DB': 0,
            'DEFAULT_TIMEOUT': 500,
        },
         'pro': {
            'HOST': 'localhost',
            'PORT': 6379,
            'DB': 0,
            'DEFAULT_TIMEOUT': 500,
        }
    }

Upvotes: 1

Views: 755

Answers (0)

Related Questions