From f2d06de504f74c5924698cc60257dc4f059cd6c9 Mon Sep 17 00:00:00 2001 From: Vadym Markov Date: Tue, 10 Oct 2023 20:11:27 +0300 Subject: [PATCH] Make call to metadef namespaces API parallel This request consists of many GET requests, processed consequently. Caching is enabled here, but first call may take several seconds. Also, non-finished request may interfere with the next request at page reload, generating some warnings and browser errors Change-Id: Id792ef5e4685f23c79d33ac8628cb583f5c73446 --- openstack_dashboard/api/glance.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openstack_dashboard/api/glance.py b/openstack_dashboard/api/glance.py index 009af6ac9b..2100a87e29 100644 --- a/openstack_dashboard/api/glance.py +++ b/openstack_dashboard/api/glance.py @@ -37,6 +37,7 @@ from horizon import messages from horizon.utils.memoized import memoized from openstack_dashboard.api import base from openstack_dashboard.contrib.developer.profiler import api as profiler +from openstack_dashboard.utils import futurist_utils from openstack_dashboard.utils import settings as utils @@ -685,10 +686,12 @@ def metadefs_namespace_full_list(request, resource_type, filters=None, namespaces, has_more_data, has_prev_data = metadefs_namespace_list( request, filters, *args, **kwargs ) - return [ - metadefs_namespace_get(request, x.namespace, resource_type) - for x in namespaces - ], has_more_data, has_prev_data + + args = ((metadefs_namespace_get, [request, x.namespace, resource_type]) for + x in namespaces) + result = futurist_utils.call_functions_parallel(*args) + + return list(result), has_more_data, has_prev_data @profiler.trace