From 237e69123af60096410ffcef436ba86d0071b1be Mon Sep 17 00:00:00 2001 From: Vladimir Ulupov Date: Mon, 28 Sep 2020 11:40:27 +0300 Subject: [PATCH] pass retry param to enqueue_at func (#1343) --- rq/queue.py | 2 +- tests/test_scheduler.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rq/queue.py b/rq/queue.py index b1ffeb1..e470dfe 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -430,7 +430,7 @@ nd job = self.create_job(f, status=JobStatus.SCHEDULED, args=args, kwargs=kwargs, timeout=timeout, result_ttl=result_ttl, ttl=ttl, failure_ttl=failure_ttl, description=description, - depends_on=depends_on, job_id=job_id, meta=meta) + depends_on=depends_on, job_id=job_id, meta=meta, retry=retry) return self.schedule_job(job, datetime) diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 712a6ed..480e993 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -7,7 +7,7 @@ from multiprocessing import Process from rq import Queue from rq.compat import utc, PY2 from rq.exceptions import NoSuchJobError -from rq.job import Job +from rq.job import Job, Retry from rq.registry import FinishedJobRegistry, ScheduledJobRegistry from rq.scheduler import RQScheduler from rq.utils import current_timestamp @@ -321,3 +321,12 @@ class TestQueue(RQTestCase): self.assertTrue( now + timedelta(seconds=28) < scheduled_time < now + timedelta(seconds=32) ) + + def test_enqueue_in_with_retry(self): + """ Ensure that the retry parameter is passed + to the enqueue_at function from enqueue_in. + """ + queue = Queue(connection=self.testconn) + job = queue.enqueue_in(timedelta(seconds=30), say_hello, retry=Retry(3, [2])) + self.assertEqual(job.retries_left, 3) + self.assertEqual(job.retry_intervals, [2])