MCPcopy
hub / github.com/aio-libs/aiohttp / _get

Method _get

aiohttp/connector.py:326–345  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

324 return conn
325
326 def _get(self, key):
327 try:
328 conns = self._conns[key]
329 except KeyError:
330 return None, None
331 t1 = self._loop.time()
332 while conns:
333 transport, proto, t0 = conns.pop()
334 if transport is not None and proto.is_connected():
335 if t1 - t0 > self._keepalive_timeout:
336 transport.close()
337 transport = None
338 else:
339 if not conns:
340 # The very last connection was reclaimed: drop the key
341 del self._conns[key]
342 return transport, proto
343 # No more connections: drop the key
344 del self._conns[key]
345 return None, None
346
347 def _release(self, key, req, transport, protocol, *, should_close=False):
348 if self._closed:

Callers 4

connectMethod · 0.95
test_getMethod · 0.95
test_get_expiredMethod · 0.95

Calls 2

is_connectedMethod · 0.80
closeMethod · 0.45

Tested by 3

test_getMethod · 0.76
test_get_expiredMethod · 0.76