diff --git a/rq/scheduler.py b/rq/scheduler.py index 17e2c5d..b55f728 100644 --- a/rq/scheduler.py +++ b/rq/scheduler.py @@ -13,8 +13,7 @@ from .registry import ScheduledJobRegistry from .utils import current_timestamp, enum from .logutils import setup_loghandlers -from redis import Redis - +from redis import Redis, SSLConnection SCHEDULER_KEY_TEMPLATE = 'rq:scheduler:%s' SCHEDULER_LOCKING_KEY_TEMPLATE = 'rq:scheduler-lock:%s' @@ -47,6 +46,10 @@ class RQScheduler(object): self._scheduled_job_registries = [] self.lock_acquisition_time = None self._connection_kwargs = connection.connection_pool.connection_kwargs + self._connection_class = connection.__class__ # client + connection_class = connection.connection_pool.connection_class + if issubclass(connection_class, SSLConnection): + self._connection_kwargs['ssl'] = True self._connection = None self.interval = interval self._stop_requested = False @@ -57,8 +60,8 @@ class RQScheduler(object): def connection(self): if self._connection: return self._connection - self._connection = Redis(**self._connection_kwargs) - return Redis(**self._connection_kwargs) + self._connection = self._connection_class(**self._connection_kwargs) + return self._connection @property def acquired_locks(self):