Kaydet (Commit) b65de73a authored tarafından Joffrey F's avatar Joffrey F

Update adapters to use pool_connections instead of num_pools

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst 82390324
...@@ -60,7 +60,7 @@ class Client( ...@@ -60,7 +60,7 @@ class Client(
) )
if base_url.startswith('http+unix://'): if base_url.startswith('http+unix://'):
self._custom_adapter = UnixAdapter( self._custom_adapter = UnixAdapter(
base_url, timeout, num_pools=num_pools base_url, timeout, pool_connections=num_pools
) )
self.mount('http+docker://', self._custom_adapter) self.mount('http+docker://', self._custom_adapter)
self._unmount('http://', 'https://') self._unmount('http://', 'https://')
...@@ -72,7 +72,7 @@ class Client( ...@@ -72,7 +72,7 @@ class Client(
) )
try: try:
self._custom_adapter = NpipeAdapter( self._custom_adapter = NpipeAdapter(
base_url, timeout, num_pools=num_pools base_url, timeout, pool_connections=num_pools
) )
except NameError: except NameError:
raise errors.DockerException( raise errors.DockerException(
......
...@@ -49,11 +49,11 @@ class NpipeHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool): ...@@ -49,11 +49,11 @@ class NpipeHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
class NpipeAdapter(requests.adapters.HTTPAdapter): class NpipeAdapter(requests.adapters.HTTPAdapter):
def __init__(self, base_url, timeout=60, def __init__(self, base_url, timeout=60,
num_pools=constants.DEFAULT_NUM_POOLS): pool_connections=constants.DEFAULT_NUM_POOLS):
self.npipe_path = base_url.replace('npipe://', '') self.npipe_path = base_url.replace('npipe://', '')
self.timeout = timeout self.timeout = timeout
self.pools = RecentlyUsedContainer( self.pools = RecentlyUsedContainer(
num_pools, dispose_func=lambda p: p.close() pool_connections, dispose_func=lambda p: p.close()
) )
super(NpipeAdapter, self).__init__() super(NpipeAdapter, self).__init__()
......
...@@ -51,14 +51,14 @@ class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool): ...@@ -51,14 +51,14 @@ class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
class UnixAdapter(requests.adapters.HTTPAdapter): class UnixAdapter(requests.adapters.HTTPAdapter):
def __init__(self, socket_url, timeout=60, def __init__(self, socket_url, timeout=60,
num_pools=constants.DEFAULT_NUM_POOLS): pool_connections=constants.DEFAULT_NUM_POOLS):
socket_path = socket_url.replace('http+unix://', '') socket_path = socket_url.replace('http+unix://', '')
if not socket_path.startswith('/'): if not socket_path.startswith('/'):
socket_path = '/' + socket_path socket_path = '/' + socket_path
self.socket_path = socket_path self.socket_path = socket_path
self.timeout = timeout self.timeout = timeout
self.pools = RecentlyUsedContainer( self.pools = RecentlyUsedContainer(
num_pools, dispose_func=lambda p: p.close() pool_connections, dispose_func=lambda p: p.close()
) )
super(UnixAdapter, self).__init__() super(UnixAdapter, self).__init__()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment