Made change that ken reccomended

This commit is contained in:
alexjanousekGSA
2025-08-15 14:16:49 -04:00
parent bbdeb1ead9
commit 033c295ea3

View File

@@ -1,5 +1,4 @@
from concurrent.futures import ThreadPoolExecutor import gevent
from flask import abort, render_template, request, url_for from flask import abort, render_template, request, url_for
from app import current_service, job_api_client from app import current_service, job_api_client
@@ -37,11 +36,11 @@ def get_report_info(service_id, report_name):
def get_download_availability(service_id): def get_download_availability(service_id):
report_names = ["1-day-report", "3-day-report", "5-day-report", "7-day-report"] report_names = ["1-day-report", "3-day-report", "5-day-report", "7-day-report"]
with ThreadPoolExecutor(max_workers=4) as executor: greenlets = [
futures = [ gevent.spawn(get_report_info, service_id, name) for name in report_names
executor.submit(get_report_info, service_id, name) for name in report_names ]
] gevent.joinall(greenlets)
results = [future.result() for future in futures] results = [g.value for g in greenlets]
return { return {
"report_1_day": results[0], "report_1_day": results[0],