Skip to content

Commit

Permalink
don't try to purge jobs which have already been deleted (#4396)
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Lachish authored Nov 25, 2019
1 parent 7c97d8e commit be56035
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion redash/tasks/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def purge_failed_jobs():
for queue in Queue.all():
failed_job_ids = FailedJobRegistry(queue=queue).get_job_ids()
failed_jobs = Job.fetch_many(failed_job_ids, rq_redis_connection)
stale_jobs = [job for job in failed_jobs if (datetime.utcnow() - job.ended_at).seconds > settings.JOB_DEFAULT_FAILURE_TTL]
stale_jobs = [job for job in failed_jobs if job and (datetime.utcnow() - job.ended_at).seconds > settings.JOB_DEFAULT_FAILURE_TTL]

for job in stale_jobs:
job.delete()
Expand Down

0 comments on commit be56035

Please sign in to comment.