diff --git a/rq/job.py b/rq/job.py index 9bc08f1..81ed98e 100644 --- a/rq/job.py +++ b/rq/job.py @@ -743,6 +743,14 @@ class Job: self._cached_result = None if not self.supports_redis_streams: + if self._result is not None: + return self._result + + rv = self.connection.hget(self.key, 'result') + if rv is not None: + # cache the result + self._result = self.serializer.loads(rv) + return self._result return None if not self._cached_result: diff --git a/rq/queue.py b/rq/queue.py index 3b3e7b0..bde1ceb 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -1035,10 +1035,10 @@ class Queue: pipeline.execute() if job.failure_callback: - job.failure_callback(job, self.connection, *sys.exc_info()) + job.failure_callback(job, self.connection, *sys.exc_info()) # type: ignore else: if job.success_callback: - job.success_callback(job, self.connection, job.result) + job.success_callback(job, self.connection, job.return_value()) # type: ignore return job diff --git a/tests/test_callbacks.py b/tests/test_callbacks.py index 8d8edc7..680ee38 100644 --- a/tests/test_callbacks.py +++ b/tests/test_callbacks.py @@ -90,7 +90,7 @@ class WorkerCallbackTestCase(RQTestCase): self.assertEqual(job.get_status(), JobStatus.FINISHED) self.assertEqual( self.testconn.get('success_callback:%s' % job.id).decode(), - job.result + job.return_value() ) job = queue.enqueue(div_by_zero, on_success=save_result)