mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 08:40:29 -04:00
Merge pull request #1820 from GSA/acceptable_finish_time
fix acceptable_finish_time
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user