| 50 | 'max_pool_size'] |
| 51 | |
| 52 | def __init__(self, socket_url, timeout=60, |
| 53 | pool_connections=constants.DEFAULT_NUM_POOLS, |
| 54 | max_pool_size=constants.DEFAULT_MAX_POOL_SIZE): |
| 55 | socket_path = socket_url.replace('http+unix://', '') |
| 56 | if not socket_path.startswith('/'): |
| 57 | socket_path = f"/{socket_path}" |
| 58 | self.socket_path = socket_path |
| 59 | self.timeout = timeout |
| 60 | self.max_pool_size = max_pool_size |
| 61 | self.pools = RecentlyUsedContainer( |
| 62 | pool_connections, dispose_func=lambda p: p.close() |
| 63 | ) |
| 64 | super().__init__() |
| 65 | |
| 66 | def get_connection(self, url, proxies=None): |
| 67 | with self.pools.lock: |