Skip to content

The only downloader you need. 下载器的集大成者。

https://nuitka.net/posts/nuitka-this-week-1.html#coroutine-compatibility

XiaoYouChR5ccf27bfe347
diff --git a/features/bittorrent_pack/trackers.py b/features/bittorrent_pack/trackers.py
index 40402a08..f8fe6cb3 100644
--- a/features/bittorrent_pack/trackers.py
+++ b/features/bittorrent_pack/trackers.py
@@ -54,6 +54,8 @@ async def fetchWebTrackers(sourceUrl: str) -> list[str]:
client = niquests.AsyncSession(headers=DEFAULT_HEADERS.copy(), timeout=30, happy_eyeballs=True)
client.trust_env = False
+ # 像极了 Bilibili Pack, 这里在 nuitka 编译后 response.close() 也会导致没有报错的异常
+
try:
response = await client.get(
normalizedSource,
@@ -61,11 +63,8 @@ async def fetchWebTrackers(sourceUrl: str) -> list[str]:
verify=cfg.SSLVerify.value,
allow_redirects=True,
)
- try:
- response.raise_for_status()
- trackers = parseTrackerText(response.text)
- finally:
- response.close()
+ response.raise_for_status()
+ trackers = parseTrackerText(response.text)
finally:
await client.close()
diff --git a/features/github_pack/config.py b/features/github_pack/config.py
index 86815874..f897dce5 100644
--- a/features/github_pack/config.py
+++ b/features/github_pack/config.py
@@ -161,10 +161,7 @@ async def measureProxyLatencies() -> dict[str, int]:
allow_redirects=True,
stream=True,
)
- try:
- response.raise_for_status()
- finally:
- await response.close()
+ response.raise_for_status()
latencies[site] = max(1, int((perf_counter() - startedAt) * 1000))
except Exception as e: