quarantine preserves job timeout

main
Goran Peretin 13 years ago
parent 8bf0b8eb93
commit 317a58a3b5

@ -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."""

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

Loading…
Cancel
Save