From de0b501823fa12279e93c91bfa37f4576acf1732 Mon Sep 17 00:00:00 2001 From: Nic Cope Date: Mon, 29 Sep 2014 15:19:11 -0400 Subject: [PATCH] Pass the default worker connection into the started and finished registries In practice all the registry methods are called with pipelines, but if no connection is passed in when instantiating the registry and the connection stack is empty resolve_connection will raise NoRedisConnectionException. --- rq/worker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index 48e22a9..bf40a65 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -496,7 +496,7 @@ class Worker(object): self.prepare_job_execution(job) with self.connection._pipeline() as pipeline: - started_job_registry = StartedJobRegistry(job.origin) + started_job_registry = StartedJobRegistry(job.origin, self.connection) try: with self.death_penalty_class(job.timeout or self.queue_class.DEFAULT_TIMEOUT): @@ -514,7 +514,7 @@ class Worker(object): job._status = Status.FINISHED job.save(pipeline=pipeline) - finished_job_registry = FinishedJobRegistry(job.origin) + finished_job_registry = FinishedJobRegistry(job.origin, self.connection) finished_job_registry.add(job, result_ttl, pipeline) job.cleanup(result_ttl, pipeline=pipeline)