File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -248,24 +248,22 @@ def __init__(
248
248
self .dt_diff = dt_diff
249
249
self .binding_name = binding_name
250
250
# Create soap client
251
- timeout_seconds = _DEFAULT_TIMEOUT
252
- operation_timeout = read_timeout or _READ_TIMEOUT
253
251
connector = TCPConnector (
254
252
ssl = _NO_VERIFY_SSL_CONTEXT ,
255
253
keepalive_timeout = KEEPALIVE_EXPIRY ,
256
254
)
257
255
session = ClientSession (
258
256
connector = connector ,
259
257
timeout = aiohttp .ClientTimeout (
260
- total = timeout_seconds ,
258
+ total = _DEFAULT_TIMEOUT ,
261
259
connect = _CONNECT_TIMEOUT ,
262
- sock_read = operation_timeout ,
260
+ sock_read = read_timeout or _READ_TIMEOUT ,
263
261
),
264
262
)
265
263
self .transport = AsyncTransportProtocolErrorHandler (
266
264
session = session ,
267
- timeout = timeout_seconds ,
268
- operation_timeout = operation_timeout ,
265
+ timeout = _DEFAULT_TIMEOUT ,
266
+ operation_timeout = read_timeout or _READ_TIMEOUT ,
269
267
verify_ssl = False ,
270
268
)
271
269
if not no_cache :
Original file line number Diff line number Diff line change @@ -57,6 +57,12 @@ def __init__(
57
57
self .proxy = proxy
58
58
self ._close_session = session is None
59
59
60
+ # Pre-create timeout object to avoid recreating it on each request
61
+ effective_timeout = self .operation_timeout or self .timeout
62
+ self ._client_timeout = (
63
+ ClientTimeout (total = effective_timeout ) if effective_timeout else None
64
+ )
65
+
60
66
async def __aenter__ (self ) -> AIOHTTPTransport :
61
67
"""Enter async context."""
62
68
if self .session is None :
You can’t perform that action at this time.
0 commit comments