Merge pull request #1820 from GSA/acceptable_finish_time

fix acceptable_finish_time
This commit is contained in:
ccostino
2025-07-09 15:11:45 -04:00
committed by GitHub

View File

@@ -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)