Skip to content

Commit

Permalink
refactor(web/req): only apply timeout once
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <i@rong.moe>
  • Loading branch information
Rongronggg9 committed May 2, 2024
1 parent f3de2bb commit 8e6c91d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/web/req.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ async def _request(
async def _fetch():
async with aiohttp.ClientSession(
connector=proxy_connector,
timeout=aiohttp.ClientTimeout(total=timeout),
headers=_headers,
cookie_jar=YummyCookieJar()
) as session:
Expand Down Expand Up @@ -204,7 +203,7 @@ async def _fetch():
try:
async with semaphore_to_use:
async with locks.overall_web_semaphore:
ret = await asyncio.wait_for(_fetch(), timeout and timeout + 0.1)
ret = await asyncio.wait_for(_fetch(), timeout)
if socket_family == AF_INET6 and tries < max_tries \
and ret.status in STATUSES_SHOULD_RETRY_IN_IPV4:
raise RetryInIpv4(ret.status, ret.reason)
Expand Down

0 comments on commit 8e6c91d

Please sign in to comment.