Call move_expired_jobs_to_failed_queue before returning job_ids.

main
Selwin Ong 10 years ago
parent dc12f8aee5
commit 6d79082b62

@ -40,11 +40,12 @@ class StartedJobRegistry:
def get_job_ids(self, start=0, end=-1):
"""Returns list of all job ids."""
self.move_expired_jobs_to_failed_queue()
return [as_text(job_id) for job_id in
self.connection.zrange(self.key, start, end)]
def cleanup(self):
"""Removes expired job ids to FailedQueue."""
def move_expired_jobs_to_failed_queue(self):
"""Remove expired jobs from registry and add them to FailedQueue."""
job_ids = self.get_expired_job_ids()
if job_ids:

@ -51,7 +51,7 @@ class TestQueue(RQTestCase):
failed_queue = FailedQueue(connection=self.testconn)
self.assertTrue(failed_queue.is_empty())
self.testconn.zadd(self.registry.key, 1, 'foo')
self.registry.cleanup()
self.registry.move_expired_jobs_to_failed_queue()
self.assertIn('foo', failed_queue.job_ids)
def test_job_execution(self):

Loading…
Cancel
Save