Don't use a connection pool unless provided
To prevent left over TCP connections from keystoneclient not correctly cleaning up we shouldn't use a connection pool. This is not ideal but it was a relatively new addition so shouldn't affect performance. When we are able to find a long term solution to keystoneclient's other problems we can move back to using a connection pool. Change-Id: I45678ef89b88eea90ea04de1e3170f584b51fd8f Closes-Bug: #1282089
This commit is contained in:
parent
c48fb46956
commit
21dd75eb58
|
@ -28,6 +28,22 @@ def request(url, method='GET', **kwargs):
|
|||
return Session().request(url, method=method, **kwargs)
|
||||
|
||||
|
||||
class _FakeRequestSession(object):
|
||||
"""This object is a temporary hack that should be removed later.
|
||||
|
||||
Keystoneclient has a cyclical dependency with its managers which is
|
||||
preventing it from being cleaned up correctly. This is always bad but when
|
||||
we switched to doing connection pooling this object wasn't getting cleaned
|
||||
either and so we had left over TCP connections hanging around.
|
||||
|
||||
Until we can fix the client cleanup we rollback the use of a requests
|
||||
session and do individual connections like we used to.
|
||||
"""
|
||||
|
||||
def request(self, *args, **kwargs):
|
||||
return requests.request(*args, **kwargs)
|
||||
|
||||
|
||||
class Session(object):
|
||||
|
||||
user_agent = None
|
||||
|
@ -75,7 +91,7 @@ class Session(object):
|
|||
for forever/never. (optional, default to 30)
|
||||
"""
|
||||
if not session:
|
||||
session = requests.Session()
|
||||
session = _FakeRequestSession()
|
||||
|
||||
self.auth = auth
|
||||
self.session = session
|
||||
|
|
Loading…
Reference in New Issue