From 2481d2b1ac2f0e5adaeb981476f882d8b390974b Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 26 May 2016 16:02:57 +1000 Subject: [PATCH] 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 --- openstack_dashboard/api/swift.py | 2 -- openstack_dashboard/test/api_tests/swift_tests.py | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/openstack_dashboard/api/swift.py b/openstack_dashboard/api/swift.py index d6de14d5e6..49dd46a84b 100644 --- a/openstack_dashboard/api/swift.py +++ b/openstack_dashboard/api/swift.py @@ -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) diff --git a/openstack_dashboard/test/api_tests/swift_tests.py b/openstack_dashboard/test/api_tests/swift_tests.py index 990aa8a8b6..7ea18b6132 100644 --- a/openstack_dashboard/test/api_tests/swift_tests.py +++ b/openstack_dashboard/test/api_tests/swift_tests.py @@ -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