fix acceptable_finish_time

This commit is contained in:
Kenneth Kehl
2025-07-09 10:41:08 -07:00
parent 8860dfde47
commit 7e6bd32305

View File

@@ -51,6 +51,7 @@ def cleanup_unfinished_jobs():
for job in jobs: for job in jobs:
# The query already checks that the processing_finished time is null, so here we are saying # 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 # if it started more than 4 hours ago, that's too long
acceptable_finish_time = None
try: try:
if job.processing_started is not None: if job.processing_started is not None:
acceptable_finish_time = job.processing_started + timedelta(minutes=5) 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}.", f"Job ID {job.id} processing_started is {job.processing_started}.",
) )
raise raise
if now > acceptable_finish_time: if acceptable_finish_time and now > acceptable_finish_time:
remove_csv_object(job.original_file_name) remove_csv_object(job.original_file_name)
dao_archive_job(job) dao_archive_job(job)