1
1
import threading
2
2
from getpass import getpass
3
- from typing import BinaryIO , Optional , Union
3
+ from typing import Any , BinaryIO , Dict , Optional , Union
4
4
5
5
from dvc_objects .fs .base import AnyFSPath , FileSystem
6
6
from dvc_objects .fs .callbacks import DEFAULT_CALLBACK , Callback
@@ -40,7 +40,6 @@ class HTTPFileSystem(FileSystem):
40
40
41
41
def _prepare_credentials (self , ** config ):
42
42
import aiohttp
43
- from fsspec .asyn import fsspec_loop
44
43
45
44
credentials = {}
46
45
client_kwargs = credentials .setdefault ("client_kwargs" , {})
@@ -74,20 +73,11 @@ def _prepare_credentials(self, **config):
74
73
f"Auth method { auth_method !r} is not supported."
75
74
)
76
75
77
- # Force cleanup of closed SSL transports.
78
- # https://github.com/iterative/dvc/issues/7414
79
- connector_kwargs = {"enable_cleanup_closed" : True }
80
-
81
76
if "ssl_verify" in config :
82
- connector_kwargs .update (ssl = make_context (config ["ssl_verify" ]))
83
-
84
- with fsspec_loop ():
85
- client_kwargs ["connector" ] = aiohttp .TCPConnector (
86
- ** connector_kwargs
87
- )
88
- # The connector should not be owned by aiohttp.ClientSession since
89
- # it is closed by fsspec (HTTPFileSystem.close_session)
90
- client_kwargs ["connector_owner" ] = False
77
+ client_kwargs ["connector_kwargs" ] = {
78
+ "ssl" : make_context (config ["ssl_verify" ])
79
+ }
80
+
91
81
client_kwargs ["connect_timeout" ] = config .get (
92
82
"connect_timeout" , self .REQUEST_TIMEOUT
93
83
)
@@ -110,6 +100,7 @@ async def get_client(
110
100
connect_timeout : Optional [float ],
111
101
sock_connect_timeout : Optional [float ],
112
102
sock_read_timeout : Optional [float ],
103
+ connector_kwargs : Optional [Dict [str , Any ]] = None ,
113
104
** kwargs ,
114
105
):
115
106
import aiohttp
@@ -136,6 +127,9 @@ async def get_client(
136
127
sock_read = sock_read_timeout ,
137
128
)
138
129
130
+ if connector_kwargs :
131
+ kwargs ["connector" ] = aiohttp .TCPConnector (** connector_kwargs )
132
+
139
133
return ReadOnlyRetryClient (** kwargs )
140
134
141
135
@cached_property
0 commit comments