quarantine preserves job timeout

This commit is contained in:
Goran Peretin 2012-07-17 08:08:35 +02:00
parent 8bf0b8eb93
commit 317a58a3b5
2 changed files with 11 additions and 1 deletions

View File

@ -263,7 +263,7 @@ class FailedQueue(Queue):
""" """
job.ended_at = times.now() job.ended_at = times.now()
job.exc_info = exc_info job.exc_info = exc_info
return self.enqueue_job(job, set_meta_data=False) return self.enqueue_job(job, timeout=job.timeout, set_meta_data=False)
def requeue(self, job_id): def requeue(self, job_id):
"""Requeues the job with the given job ID.""" """Requeues the job with the given job ID."""

View File

@ -217,3 +217,13 @@ class TestFailedQueue(RQTestCase):
# Assert that we cannot requeue a job that's not on the failed queue # Assert that we cannot requeue a job that's not on the failed queue
with self.assertRaises(InvalidJobOperationError): with self.assertRaises(InvalidJobOperationError):
get_failed_queue().requeue(job.id) get_failed_queue().requeue(job.id)
def test_quarantine_preserves_timeout(self):
"""Quarantine preserves job timeout."""
job = Job.create(div_by_zero, 1, 2, 3)
job.origin = 'fake'
job.timeout = 200
job.save()
get_failed_queue().quarantine(job, Exception('Some fake error'))
self.assertEquals(job.timeout, 200)