Update adapters to use pool_connections instead of num_pools

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-10-04 12:19:33 -07:00
parent 8239032463
commit b65de73afe
3 changed files with 6 additions and 6 deletions

View File

@ -60,7 +60,7 @@ class Client(
)
if base_url.startswith('http+unix://'):
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._unmount('http://', 'https://')
@ -72,7 +72,7 @@ class Client(
)
try:
self._custom_adapter = NpipeAdapter(
base_url, timeout, num_pools=num_pools
base_url, timeout, pool_connections=num_pools
)
except NameError:
raise errors.DockerException(

View File

@ -49,11 +49,11 @@ class NpipeHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
class NpipeAdapter(requests.adapters.HTTPAdapter):
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.timeout = timeout
self.pools = RecentlyUsedContainer(
num_pools, dispose_func=lambda p: p.close()
pool_connections, dispose_func=lambda p: p.close()
)
super(NpipeAdapter, self).__init__()

View File

@ -51,14 +51,14 @@ class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
class UnixAdapter(requests.adapters.HTTPAdapter):
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://', '')
if not socket_path.startswith('/'):
socket_path = '/' + socket_path
self.socket_path = socket_path
self.timeout = timeout
self.pools = RecentlyUsedContainer(
num_pools, dispose_func=lambda p: p.close()
pool_connections, dispose_func=lambda p: p.close()
)
super(UnixAdapter, self).__init__()