When stopped jobs are deleted, they should also be removed from FailedJobRegistry. (#1677)

This commit is contained in:
Selwin Ong 2022-07-24 10:56:35 +07:00 committed by GitHub
parent 468eb00c13
commit 145884fcd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -772,7 +772,7 @@ class Job:
serializer=self.serializer)
registry.remove(self, pipeline=pipeline)
elif self.is_failed:
elif self.is_failed or self.is_stopped:
self.failed_job_registry.remove(self, pipeline=pipeline)
elif self.is_canceled:

View File

@ -621,6 +621,15 @@ class TestJob(RQTestCase):
job.delete()
self.assertFalse(job in registry)
job = Job.create(func=fixtures.say_hello, status=JobStatus.STOPPED,
connection=self.testconn, origin='default', serializer=JSONSerializer)
job.save()
registry = FailedJobRegistry(connection=self.testconn, serializer=JSONSerializer)
registry.add(job, 500)
job.delete()
self.assertFalse(job in registry)
job = Job.create(func=fixtures.say_hello, status=JobStatus.FINISHED,
connection=self.testconn, origin='default', serializer=JSONSerializer)
job.save()