From fae7df5aa7a5db820f4e60533e0151f8144e8af7 Mon Sep 17 00:00:00 2001 From: Selwin Ong Date: Tue, 9 Sep 2014 23:58:35 +0700 Subject: [PATCH] Renamed StartedJobRegistry.get_job_count to StartedJobRegistry.count for consistency. --- rq/registry.py | 5 +++-- tests/test_job_started_registry.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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)