Skip to content

Commit

Permalink
Fix resolve_connection deprecation rq#304
Browse files Browse the repository at this point in the history
The Connection context manager in rq is deprecated.
When a connection is explicitly passed to the Scheduler
avoid using the manager and triggering a warning.
  • Loading branch information
soulseekah committed Jan 4, 2024
1 parent 0521e7f commit 03009e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rq_scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ class Scheduler(object):

def __init__(self, queue_name='default', queue=None, interval=60, connection=None,
job_class=None, queue_class=None, name=None):
from rq.connections import resolve_connection
self.connection = resolve_connection(connection)
self.connection = connection
if self.connection is None:
from rq.connections import resolve_connection
self.connection = resolve_connection(connection)
self._queue = queue
if self._queue is None:
self.queue_name = queue_name
Expand Down

0 comments on commit 03009e5

Please sign in to comment.