File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11import asyncio
2- import os
32import sys
43import time
54from concurrent .futures import ThreadPoolExecutor
2120CONCURRENCY = 20
2221POOL_LIMIT = 100
2322PROFILE = False
24- os . environ [ "HTTPCORE_PREFER_ANYIO" ] = "0"
23+ NET_BACKEND = httpcore . AsyncioBackend
2524
2625
2726def duration (start : float ) -> int :
@@ -66,7 +65,9 @@ async def aiohttp_get(session: aiohttp.ClientSession, timings: List[int]) -> Non
6665 assert res .status == 200 , f"status={ res .status } "
6766 timings .append (duration (start ))
6867
69- async with httpcore .AsyncConnectionPool (max_connections = POOL_LIMIT ) as pool :
68+ async with httpcore .AsyncConnectionPool (
69+ max_connections = POOL_LIMIT , network_backend = NET_BACKEND ()
70+ ) as pool :
7071 # warmup
7172 await gather_limited_concurrency (
7273 (httpcore_get (pool , []) for _ in range (REQUESTS )), CONCURRENCY * 2
You can’t perform that action at this time.
0 commit comments