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

alterable scheduler keys #150

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
8 changes: 7 additions & 1 deletion rq_scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ class Scheduler(object):
scheduler_key = 'rq:scheduler'
scheduled_jobs_key = 'rq:scheduler:scheduled_jobs'

def __init__(self, queue_name='default', interval=60, connection=None):
def __init__(self, queue_name='default', interval=60, connection=None, scheduler_key=None, scheduled_jobs_key=None):
from rq.connections import resolve_connection
self.connection = resolve_connection(connection)
self.queue_name = queue_name
self._interval = interval
self.log = logger
self._lock_acquired = False

if scheduler_key:
self.scheduler_key = scheduler_key

if scheduled_jobs_key:
self.scheduled_jobs_key = scheduled_jobs_key

def register_birth(self):
if self.connection.exists(self.scheduler_key) and \
not self.connection.hexists(self.scheduler_key, 'death'):
Expand Down