diff options
-rw-r--r-- | apscheduler/jobstores/redis.py | 12 | ||||
-rw-r--r-- | docs/versionhistory.rst | 6 | ||||
-rw-r--r-- | setup.py | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/apscheduler/jobstores/redis.py b/apscheduler/jobstores/redis.py index 61f913e..5bb69d6 100644 --- a/apscheduler/jobstores/redis.py +++ b/apscheduler/jobstores/redis.py @@ -14,7 +14,7 @@ except ImportError: # pragma: nocover import pickle try: - from redis import StrictRedis + from redis import Redis except ImportError: # pragma: nocover raise ImportError('RedisJobStore requires redis installed') @@ -47,7 +47,7 @@ class RedisJobStore(BaseJobStore): self.pickle_protocol = pickle_protocol self.jobs_key = jobs_key self.run_times_key = run_times_key - self.redis = StrictRedis(db=int(db), **connect_args) + self.redis = Redis(db=int(db), **connect_args) def lookup_job(self, job_id): job_state = self.redis.hget(self.jobs_key, job_id) @@ -81,7 +81,9 @@ class RedisJobStore(BaseJobStore): pipe.hset(self.jobs_key, job.id, pickle.dumps(job.__getstate__(), self.pickle_protocol)) if job.next_run_time: - pipe.zadd(self.run_times_key, datetime_to_utc_timestamp(job.next_run_time), job.id) + pipe.zadd(self.run_times_key, + {job.id: datetime_to_utc_timestamp(job.next_run_time)}) + pipe.execute() def update_job(self, job): @@ -92,9 +94,11 @@ class RedisJobStore(BaseJobStore): pipe.hset(self.jobs_key, job.id, pickle.dumps(job.__getstate__(), self.pickle_protocol)) if job.next_run_time: - pipe.zadd(self.run_times_key, datetime_to_utc_timestamp(job.next_run_time), job.id) + pipe.zadd(self.run_times_key, + {job.id: datetime_to_utc_timestamp(job.next_run_time)}) else: pipe.zrem(self.run_times_key, job.id) + pipe.execute() def remove_job(self, job_id): diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst index ce4e862..7f0e0a9 100644 --- a/docs/versionhistory.rst +++ b/docs/versionhistory.rst @@ -4,6 +4,12 @@ Version history To find out how to migrate your application from a previous version of APScheduler, see the :doc:`migration section <migration>`. +UNRELEASED +---------- + +* Adapted ``RedisJobStore`` to v3.0 of the ``redis`` library + + 3.5.3 ----- @@ -48,7 +48,7 @@ setup( 'asyncio:python_version == "2.7"': ['trollius'], 'gevent': ['gevent'], 'mongodb': ['pymongo >= 2.8'], - 'redis': ['redis'], + 'redis': ['redis >= 3.0'], 'rethinkdb': ['rethinkdb'], 'sqlalchemy': ['sqlalchemy >= 0.8'], 'tornado': ['tornado >= 4.3'], |