mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
Made change that ken reccomended
This commit is contained in:
@@ -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],
|
||||||
|
|||||||
Reference in New Issue
Block a user