diff --git a/rq/worker.py b/rq/worker.py index 6d8cc5e..8720504 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -757,8 +757,8 @@ class Worker: serializer=self.serializer, ) if result is not None: - self.log.debug(f"Dequeued job {blue(result[0].id)} from {green(result[1].name)}") job, queue = result + self.log.debug(f"Dequeued job {blue(job.id)} from {green(queue.name)}") job.redis_server_version = self.get_redis_server_version() if self.log_job_description: self.log.info('%s: %s (%s)', green(queue.name), blue(job.description), job.id) diff --git a/tests/test_worker.py b/tests/test_worker.py index e001a95..b0bb3d7 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -634,6 +634,14 @@ class TestWorker(RQTestCase): res.refresh() self.assertIn('JobTimeoutException', as_text(res.exc_info)) + def test_dequeue_job_and_maintain_ttl_non_blocking(self): + """Not passing a timeout should return immediately with None as a result""" + q = Queue() + w = Worker([q]) + + # Put it on the queue with a timeout value + self.assertIsNone(w.dequeue_job_and_maintain_ttl(None)) + def test_worker_sets_result_ttl(self): """Ensure that Worker properly sets result_ttl for individual jobs.""" q = Queue()