diff --git a/rq/registry.py b/rq/registry.py index 2e5fd22..0242280 100644 --- a/rq/registry.py +++ b/rq/registry.py @@ -23,9 +23,10 @@ class StartedJobRegistry: def __len__(self): """Returns the number of jobs in this registry""" - return self.get_job_count() + return self.count - def get_job_count(self): + @property + def count(self): """Returns the number of jobs in this registry""" self.move_expired_jobs_to_failed_queue() return self.connection.zcard(self.key) diff --git a/tests/test_job_started_registry.py b/tests/test_job_started_registry.py index 312f762..f99aafd 100644 --- a/tests/test_job_started_registry.py +++ b/tests/test_job_started_registry.py @@ -81,5 +81,5 @@ class TestQueue(RQTestCase): """StartedJobRegistry returns the right number of job count.""" self.testconn.zadd(self.registry.key, 1, 'foo') self.testconn.zadd(self.registry.key, 10, 'bar') - self.assertEqual(self.registry.get_job_count(), 2) + self.assertEqual(self.registry.count, 2) self.assertEqual(len(self.registry), 2)