Renamed StartedJobRegistry.get_job_count to StartedJobRegistry.count for consistency.

main
Selwin Ong 10 years ago
parent 41ae1ce8a7
commit fae7df5aa7

@ -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)

@ -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)

Loading…
Cancel
Save