From f9ddf7dca5b4e0182d86a9d6397502f6e460517b Mon Sep 17 00:00:00 2001 From: Selwin Ong Date: Sat, 21 Aug 2021 17:07:29 +0700 Subject: [PATCH] Requeueing job should clear job.exc_info (#1543) --- rq/registry.py | 1 + tests/test_cli.py | 8 +++----- tests/test_registry.py | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rq/registry.py b/rq/registry.py index 7c25cab..4d55d74 100644 --- a/rq/registry.py +++ b/rq/registry.py @@ -231,6 +231,7 @@ class FailedJobRegistry(BaseRegistry): job_class=self.job_class) job.started_at = None job.ended_at = None + job.exc_info = '' job.save() job = queue.enqueue_job(job, pipeline=pipeline) pipeline.execute() diff --git a/tests/test_cli.py b/tests/test_cli.py index e7f94fd..e653355 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -386,12 +386,10 @@ class TestRQCli(RQTestCase): prefix = 'Enqueued tests.fixtures.say_hello() with job-id \'' suffix = '\'.\n' - print(result.stdout) + self.assertTrue(result.output.startswith(prefix)) + self.assertTrue(result.output.endswith(suffix)) - self.assertTrue(result.stdout.startswith(prefix)) - self.assertTrue(result.stdout.endswith(suffix)) - - job_id = result.stdout[len(prefix):-len(suffix)] + job_id = result.output[len(prefix):-len(suffix)] queue_key = 'rq:queue:default' self.assertEqual(self.connection.llen(queue_key), 1) self.assertEqual(self.connection.lrange(queue_key, 0, -1)[0].decode('ascii'), job_id) diff --git a/tests/test_registry.py b/tests/test_registry.py index 0dd7772..9603bca 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -357,6 +357,7 @@ class TestFailedJobRegistry(RQTestCase): self.assertEqual(job.get_status(), JobStatus.QUEUED) self.assertEqual(job.started_at, None) self.assertEqual(job.ended_at, None) + self.assertEqual(job.exc_info, '') worker.work(burst=True) self.assertTrue(job in registry)