From 7fa9b6bdd761f464689da3d94dbc780750f5bd72 Mon Sep 17 00:00:00 2001
From: Bjarke Madsen <bjarke.madsen@geant.org>
Date: Wed, 3 Mar 2021 13:54:38 +0100
Subject: [PATCH] Concurrent provisioning too stronk, scale it down. Grafana
 started throwing error 500's because the VMs can't keep up

---
 brian_dashboard_manager/grafana/provision.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/brian_dashboard_manager/grafana/provision.py b/brian_dashboard_manager/grafana/provision.py
index 2a69308..c805817 100644
--- a/brian_dashboard_manager/grafana/provision.py
+++ b/brian_dashboard_manager/grafana/provision.py
@@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
 
 
 def generate_all_nrens(token_request, nrens, folder_id, datasource_name):
-    with ThreadPoolExecutor(max_workers=12) as executor:
+    with ThreadPoolExecutor(max_workers=4) as executor:
         for dashboard in generate_nrens(nrens, datasource_name):
             executor.submit(create_dashboard, token_request,
                             dashboard, folder_id)
@@ -54,7 +54,7 @@ def provision_folder(token_request, folder_name,
     data = get_interface_data(relevant_interfaces, parse_func)
     dash_data = get_dashboard_data(data, datasource_name, tag, errors)
 
-    with ThreadPoolExecutor(max_workers=12) as executor:
+    with ThreadPoolExecutor(max_workers=4) as executor:
         for dashboard in dash_data:
             rendered = render_dashboard(dashboard)
             executor.submit(create_dashboard, token_request,
@@ -81,7 +81,7 @@ def provision(config):
     start = time.time()
 
     with ProcessPoolExecutor(max_workers=4) as org_executor, \
-            ThreadPoolExecutor(max_workers=12) as thread_executor:
+            ThreadPoolExecutor(max_workers=4) as thread_executor:
         for org in all_orgs:
             org_id = org['id']
             delete_expired_api_tokens(request, org_id)
-- 
GitLab