rq / rq-scheduler

A lightweight library that adds job scheduling capabilities to RQ (Redis Queue)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation needs update. queue vs queue_name

jgerry2002 opened this issue · comments

In the example:

scheduler = Scheduler(queue=queue)

This will return errors regarding connectivity to redis, when in fact it the option argument is now queue_name vs queue.

When I tested:

scheduler = Scheduler(queue_name=queue)

Everything worked as it should.

commented

@jgerry2002 I tried this and wasn't able to get it to work. When I try to run it with a normal queue, it works perfectly fine and I can add jobs to the queue, but with the scheduler, I get an error. This is my code:

from redis import Redis
from rq import Queue
from rq_scheduler import Scheduler

rq = Queue(connection=Redis(host=BaseConfig.REDIS_HOST, port=BaseConfig.REDIS_PORT))
rqs = Scheduler(queue_name=rq)

And I'm still getting a NoRedisConnectionException: Could not resolve a Redis connection error.

@sikula , add the connection parameter to Scheduler:

redis_conn = Redis(host=BaseConfig.REDIS_HOST, port=BaseConfig.REDIS_PORT)
rq = Queue(connection=redis_conn)
rqs = Scheduler(queue_name=rq, connection=redis_conn)

you can see show Scheduler is constructed here

Added an additional example in this commit that will hopefully clarify things a bit more: ee60c19