From 34d161eb11ca60631c9d7098d5c080d55ee77205 Mon Sep 17 00:00:00 2001 From: Goran Peretin Date: Tue, 17 Jul 2012 08:41:24 +0200 Subject: [PATCH] requeueing preserves job timeout --- rq/queue.py | 2 +- tests/test_queue.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rq/queue.py b/rq/queue.py index ac5bd52..a7e5dfe 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -280,4 +280,4 @@ class FailedQueue(Queue): job.exc_info = None q = Queue(job.origin, connection=self.connection) - q.enqueue_job(job) + q.enqueue_job(job, timeout=job.timeout) diff --git a/tests/test_queue.py b/tests/test_queue.py index 93a0c9b..9f2c4da 100644 --- a/tests/test_queue.py +++ b/tests/test_queue.py @@ -227,3 +227,15 @@ class TestFailedQueue(RQTestCase): get_failed_queue().quarantine(job, Exception('Some fake error')) self.assertEquals(job.timeout, 200) + + def test_requeueing_preserves_timeout(self): + """Requeueing 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')) + get_failed_queue().requeue(job.id) + + job = Job.fetch(job.id) + self.assertEquals(job.timeout, 200)