Skip to content

Commit 02f39bd

Browse files
authored
Merge pull request #2354 from GSA/fix_runaway_report_generation
fix runaway report generation
2 parents f9fd580 + 1eb12b9 commit 02f39bd

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

app/main/views/dashboard.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ def service_dashboard(service_id):
6565
active_jobs = [job for job in job_response if job["job_status"] != "cancelled"]
6666
sorted_jobs = sorted(active_jobs, key=lambda job: job["created_at"], reverse=True)
6767
job_lists = [
68-
{
69-
**job_dict,
70-
"finished_processing": job_is_finished(job_dict)
71-
}
68+
{**job_dict, "finished_processing": job_is_finished(job_dict)}
7269
for job_dict in sorted_jobs
7370
]
7471

@@ -91,7 +88,7 @@ def job_is_finished(job_dict):
9188
"technical-failure",
9289
"temporary-failure",
9390
"permanent-failure",
94-
"cancelled"
91+
"cancelled",
9592
]
9693

9794
processed_count = sum(

app/utils/csv.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ def generate_notifications_csv(**kwargs):
128128
notifications_resp = notification_api_client.get_notifications_for_service(
129129
**kwargs
130130
)
131+
# Stop if we are finished
132+
if (
133+
notifications_resp.get("notifications") is None
134+
or len(notifications_resp["notifications"]) == 0
135+
):
136+
return
137+
131138
for notification in notifications_resp["notifications"]:
132139
preferred_tz_created_at = convert_report_date_to_preferred_timezone(
133140
notification["created_at"]

0 commit comments

Comments
 (0)