Remove memoize that holds connections open

This memoize usage holds on to connection objects for a very long
time, resulting in exhaustion of file descriptors.

Change-Id: If7367819b050a65562b3e05175ab15bd93d0d398
Fixes-Bug: 1584109
This commit is contained in:
Richard Jones 2016-05-26 16:02:57 +10:00
parent 91443dfda1
commit 2481d2b1ac
2 changed files with 5 additions and 7 deletions

View File

@ -24,7 +24,6 @@ from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon.utils.memoized import memoized # noqa
from openstack_dashboard.api import base
@ -103,7 +102,6 @@ def _metadata_to_header(metadata):
return headers
@memoized
def swift_api(request):
endpoint = base.url_for(request, 'object-store')
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)

View File

@ -68,7 +68,7 @@ class SwiftApiTests(test.APITestCase):
metadata = {'is_public': False}
container = self.containers.first()
headers = api.swift._metadata_to_header(metadata=(metadata))
swift_api = self.stub_swiftclient()
swift_api = self.stub_swiftclient(2)
# Check for existence, then create
exc = self.exceptions.swift
swift_api.head_container(container.name).AndRaise(exc)
@ -173,7 +173,7 @@ class SwiftApiTests(test.APITestCase):
def test_swift_create_pseudo_folder(self):
container = self.containers.first()
folder = self.folder.first()
swift_api = self.stub_swiftclient()
swift_api = self.stub_swiftclient(2)
exc = self.exceptions.swift
swift_api.head_object(container.name, folder.name).AndRaise(exc)
swift_api.put_object(container.name,
@ -211,7 +211,7 @@ class SwiftApiTests(test.APITestCase):
headers = {'X-Object-Meta-Orig-Filename': fake_name}
swift_api = self.stub_swiftclient()
swift_api = self.stub_swiftclient(2)
exc = self.exceptions.swift
swift_api.head_object(container.name, obj.name).AndRaise(exc)
test_file = FakeFile()
@ -253,7 +253,7 @@ class SwiftApiTests(test.APITestCase):
container = self.containers.first()
obj = self.objects.first()
swift_api = self.stub_swiftclient()
swift_api = self.stub_swiftclient(2)
exc = self.exceptions.swift
swift_api.head_object(container.name, obj.name).AndRaise(exc)
swift_api.put_object(container.name,
@ -273,7 +273,7 @@ class SwiftApiTests(test.APITestCase):
container = self.containers.first()
obj = self.objects.first()
swift_api = self.stub_swiftclient()
swift_api = self.stub_swiftclient(2)
swift_api.head_object(container.name, obj.name).AndReturn(container)
exc = self.exceptions.swift