Reduce API client object in a request
Mistralclient is created every time methods in api. It leads to regeneration of API HTTP connections. This commit caches API client object for a WSGI request to reduce the number of HTTP connection to backends. As WSGI request object is recreated, a cached API client object will live in a single request. Change-Id: I46f101505801f8d650722c9c84397ab4d813e097
This commit is contained in:
parent
307cde8cd8
commit
f330cca03b
|
@ -16,6 +16,7 @@
|
|||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon.utils import memoized
|
||||
|
||||
from mistralclient.api import client as mistral_client
|
||||
from mistraldashboard.handle_errors import handle_errors
|
||||
|
@ -23,6 +24,7 @@ from mistraldashboard.handle_errors import handle_errors
|
|||
SERVICE_TYPE = 'workflowv2'
|
||||
|
||||
|
||||
@memoized.memoized
|
||||
def mistralclient(request):
|
||||
return mistral_client.client(
|
||||
username=request.user.username,
|
||||
|
|
Loading…
Reference in New Issue