From 317a58a3b5ae816fb980db7fff71d81cfab1e74d Mon Sep 17 00:00:00 2001 From: Goran Peretin Date: Tue, 17 Jul 2012 08:08:35 +0200 Subject: [PATCH] quarantine preserves job timeout --- rq/queue.py | 2 +- tests/test_queue.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rq/queue.py b/rq/queue.py index 0f071390..ac5bd523 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -263,7 +263,7 @@ class FailedQueue(Queue): """ job.ended_at = times.now() 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): """Requeues the job with the given job ID.""" diff --git a/tests/test_queue.py b/tests/test_queue.py index a75abf58..93a0c9bc 100644 --- a/tests/test_queue.py +++ b/tests/test_queue.py @@ -217,3 +217,13 @@ class TestFailedQueue(RQTestCase): # Assert that we cannot requeue a job that's not on the failed queue with self.assertRaises(InvalidJobOperationError): 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)