From 7e6bd323059146586462c06315ca3b648764ebdb Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Wed, 9 Jul 2025 10:41:08 -0700 Subject: [PATCH] fix acceptable_finish_time --- app/celery/nightly_tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/celery/nightly_tasks.py b/app/celery/nightly_tasks.py index 01bdbbd67..f6f4edec1 100644 --- a/app/celery/nightly_tasks.py +++ b/app/celery/nightly_tasks.py @@ -51,6 +51,7 @@ def cleanup_unfinished_jobs(): for job in jobs: # The query already checks that the processing_finished time is null, so here we are saying # if it started more than 4 hours ago, that's too long + acceptable_finish_time = None try: if job.processing_started is not None: acceptable_finish_time = job.processing_started + timedelta(minutes=5) @@ -59,7 +60,7 @@ def cleanup_unfinished_jobs(): f"Job ID {job.id} processing_started is {job.processing_started}.", ) raise - if now > acceptable_finish_time: + if acceptable_finish_time and now > acceptable_finish_time: remove_csv_object(job.original_file_name) dao_archive_job(job)