Optimizes API Calls
Through additional profiling, I found a few more places where caching could be enabled to reduce network calls and speed up page load times slightly. This patch adds caching to frequently used methods and provides for minor improvements. Tested in both virt and baremetal environments. Change-Id: I768d6643c4523d33c440a13f5ddc5212555956a8
This commit is contained in:
parent
99201028f7
commit
c00978551d
@ -34,6 +34,7 @@ from tuskar_ui.utils import utils
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@memoized.memoized
|
||||
def overcloud_keystoneclient(request, endpoint, password):
|
||||
"""Returns a client connected to the Keystone backend.
|
||||
|
||||
|
@ -56,6 +56,7 @@ IRONIC_DISCOVERD_URL = getattr(settings, 'IRONIC_DISCOVERD_URL', None)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@memoized.memoized
|
||||
def ironicclient(request):
|
||||
api_version = 1
|
||||
kwargs = {'os_auth_token': request.user.token.id,
|
||||
@ -156,6 +157,7 @@ class Node(base.APIResourceWrapper):
|
||||
return cls(node, request)
|
||||
|
||||
@classmethod
|
||||
@memoized.memoized
|
||||
@handle_errors(_("Unable to retrieve node"))
|
||||
def get(cls, request, uuid):
|
||||
"""Return the Node that matches the ID
|
||||
@ -199,6 +201,7 @@ class Node(base.APIResourceWrapper):
|
||||
return cls(node, request, server)
|
||||
|
||||
@classmethod
|
||||
@memoized.memoized
|
||||
@handle_errors(_("Unable to retrieve nodes"), [])
|
||||
def list(cls, request, associated=None, maintenance=None):
|
||||
"""Return a list of Nodes
|
||||
@ -302,6 +305,7 @@ class Node(base.APIResourceWrapper):
|
||||
return cls(node, request)
|
||||
|
||||
@classmethod
|
||||
@memoized.memoized
|
||||
def list_ports(cls, request, uuid):
|
||||
"""Return a list of ports associated with this Node
|
||||
|
||||
|
@ -352,6 +352,7 @@ class Role(base.APIResourceWrapper):
|
||||
self._request = request
|
||||
|
||||
@classmethod
|
||||
@memoized.memoized
|
||||
@handle_errors(_("Unable to retrieve overcloud roles"), [])
|
||||
def list(cls, request):
|
||||
"""Return a list of Overcloud Roles in Tuskar
|
||||
@ -367,6 +368,7 @@ class Role(base.APIResourceWrapper):
|
||||
return [cls(role, request=request) for role in roles]
|
||||
|
||||
@classmethod
|
||||
@memoized.memoized
|
||||
@handle_errors(_("Unable to retrieve overcloud role"))
|
||||
def get(cls, request, role_id):
|
||||
"""Return the Tuskar Role that matches the ID
|
||||
|
Loading…
x
Reference in New Issue
Block a user