mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-08 21:43:13 -04:00
fix acceptable_finish_time
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user