Skip to content

Commit dbaaacf

Browse files
committed
bug(api)!: remove timeout code
BREAKING CHANGE: Remove timeout code and `timeout` parameter from method signatures, because it gives the impression of doing something, but seems to be ineffective (see #44 (comment)).
1 parent 8449bc0 commit dbaaacf

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

requests_unixsocket/adapters.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818
# https://github.com/docker/docker-py/blob/master/docker/transport/unixconn.py
1919
class UnixHTTPConnection(httplib.HTTPConnection, object):
2020

21-
def __init__(self, unix_socket_url, timeout=60):
21+
def __init__(self, unix_socket_url):
2222
"""Create an HTTP connection to a unix domain socket
2323
2424
:param unix_socket_url: A URL with a scheme of 'http+unix' and the
2525
netloc is a percent-encoded path to a unix domain socket. E.g.:
2626
'http+unix://%2Ftmp%2Fprofilesvc.sock/status/pid'
2727
"""
28-
super(UnixHTTPConnection, self).__init__('localhost', timeout=timeout)
28+
super(UnixHTTPConnection, self).__init__('localhost')
2929
self.unix_socket_url = unix_socket_url
30-
self.timeout = timeout
3130
self.sock = None
3231

3332
def __del__(self): # base class does not have d'tor
@@ -44,21 +43,18 @@ def connect(self):
4443

4544
class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
4645

47-
def __init__(self, socket_path, timeout=60):
48-
super(UnixHTTPConnectionPool, self).__init__(
49-
'localhost', timeout=timeout)
46+
def __init__(self, socket_path):
47+
super(UnixHTTPConnectionPool, self).__init__('localhost')
5048
self.socket_path = socket_path
51-
self.timeout = timeout
5249

5350
def _new_conn(self):
54-
return UnixHTTPConnection(self.socket_path, self.timeout)
51+
return UnixHTTPConnection(self.socket_path)
5552

5653

5754
class UnixAdapter(HTTPAdapter):
5855

59-
def __init__(self, timeout=60, pool_connections=25, *args, **kwargs):
56+
def __init__(self, pool_connections=25, *args, **kwargs):
6057
super(UnixAdapter, self).__init__(*args, **kwargs)
61-
self.timeout = timeout
6258
self.pools = urllib3._collections.RecentlyUsedContainer(
6359
pool_connections, dispose_func=lambda p: p.close()
6460
)
@@ -76,7 +72,7 @@ def get_connection(self, url, proxies=None):
7672
if pool:
7773
return pool
7874

79-
pool = UnixHTTPConnectionPool(url, self.timeout)
75+
pool = UnixHTTPConnectionPool(url)
8076
self.pools[url] = pool
8177

8278
return pool

0 commit comments

Comments
 (0)