Aqr-K
|
c745616495
|
perf(http): 异步 HTTP 引入共享 AsyncHTTPTransport,复用 TCP/TLS 握手
AsyncRequestUtils 使用按事件循环弱引用持有的共享
AsyncHTTPTransport 作为底层连接池与 TLS 会话;每次请求创建轻量
AsyncClient 承载本次 cookie jar、timeout、follow_redirects,
用完即销毁。共享 transport 由 _NonClosingTransportProxy 包装后
注入 AsyncClient,吞掉 AsyncClient 退出时向底层 transport
传播的 __aexit__/aclose,使底层连接池跨调用持久,从而真正复用
TCP/TLS 握手。
设计要点:
- 共享 transport 桶按 (proxy, verify, max_keepalive_connections,
max_connections, keepalive_expiry) 区分;每事件循环 32 桶 LRU
上限,超出后异步关闭最久未用桶;关闭 task 由模块级强引用集合
持有以兼容 Python 3.11+ 的任务 GC 行为。
- 通过 FastAPI lifespan shutdown 调用 aclose_shared_async_transports
集中释放底层 transport,避免 ResourceWarning。
- AsyncRequestUtils.request 走三条 path:用户自管 client / 共享
transport + per-call AsyncClient / 兜底临时 client。三条路径
cookie 语义一致;后两条因 per-call AsyncClient 生命周期局限于
单次调用,天然不积累 Set-Cookie,避免跨调用 jar 演化串扰。
- _make_request 对幂等方法(GET/HEAD/OPTIONS)在
RemoteProtocolError / ReadError / WriteError 时单次重试,
容忍 keep-alive stale 连接命中;非幂等方法不重试,但记录
debug 日志。
- get_stream 使用 httpx.AsyncClient.stream() 标准流式 API,与
request 共用三条 path 的 client 选择逻辑;幂等单次重试;
yield 体异常透传给 stream 的 __aexit__。
公共 API 表面零变动。插件可通过 max_keepalive_connections /
max_connections / keepalive_expiry 三个 limits 参数为自己定制
连接池容量与握手有效期。
TMDB 真实压测(10 部美剧 × 每部 50 集,1020 请求):
61.96s → 18.15s(3.41×),单请求 p95 149.6ms → 38.1ms。
|
2026-05-11 08:46:40 +08:00 |
|
jxxghp
|
48da5c976c
|
fixx loop
|
2025-11-20 08:15:37 +08:00 |
|
jxxghp
|
6379cda148
|
fix 异步定时服务
|
2025-08-25 21:19:07 +08:00 |
|
jxxghp
|
f14f4e1e9b
|
添加异步数据库支持,更新相关模型和会话管理
|
2025-07-30 13:18:45 +08:00 |
|
jxxghp
|
0053d31f84
|
add db异步转换器
|
2025-07-30 08:54:04 +08:00 |
|
jxxghp
|
036cb6f3b0
|
remove memory helper
|
2025-07-09 19:11:37 +08:00 |
|
jxxghp
|
c06001d921
|
feat:内建重启前主动备份插件
|
2025-06-16 08:57:21 +08:00 |
|
jxxghp
|
162ba9307d
|
fix restart
|
2025-06-10 07:09:59 +08:00 |
|
jxxghp
|
d0677edaaa
|
fix 优雅停止
|
2025-06-09 15:39:11 +08:00 |
|
jxxghp
|
327d30dcc2
|
feat:识别容器是否重置
|
2025-06-09 09:15:58 +08:00 |
|
jxxghp
|
aa039c6c05
|
feat:启停插件自动备份与恢复
|
2025-06-09 08:04:44 +08:00 |
|
jxxghp
|
a18040ccfa
|
add pympler
|
2025-06-08 18:54:35 +08:00 |
|
jxxghp
|
3ee32757e5
|
rollback
|
2025-06-08 14:35:59 +08:00 |
|
jxxghp
|
a9300faaf8
|
fix:优化单例模式和类引用
|
2025-06-05 13:22:16 +08:00 |
|
jxxghp
|
079a747210
|
fix memory manager startup
|
2025-06-03 16:19:38 +08:00 |
|
jxxghp
|
225de87d4d
|
fix torrents chain
|
2025-06-03 15:48:43 +08:00 |
|
jxxghp
|
fe25f8f48f
|
fix #4277
|
2025-05-15 07:12:52 +08:00 |
|
jxxghp
|
21e5cb0a03
|
v2.4.7
- 修复了订阅文件信息显示问题
- 修复了默认通知模板格式中季号的显示问题
- 修复了原始语言图片刮削的问题
- 修复了馒头新版标签无法识别的问题
- 优化了联邦插件API的注册
|
2025-05-14 09:16:12 +08:00 |
|
jxxghp
|
a622ada58b
|
更新 lifecycle.py
|
2025-05-13 23:58:08 +08:00 |
|
jxxghp
|
ee9c4948d3
|
refactor: 优化启停逻辑
|
2025-05-13 23:47:12 +08:00 |
|
jxxghp
|
cf28e1d963
|
refactor: 优化启停逻辑
|
2025-05-13 23:11:38 +08:00 |
|
jxxghp
|
04ce774c22
|
fix plugin initializer
|
2025-05-13 21:37:10 +08:00 |
|
jxxghp
|
b86d06f632
|
add workflow lifecycle
|
2025-02-16 16:53:38 +08:00 |
|
InfinityPacer
|
62ac03fb29
|
refactor(lifecycle): add graceful support and remove signal handling
|
2024-10-18 00:39:53 +08:00 |
|
InfinityPacer
|
bcc48e885a
|
feat(setup): support asynchronous install plugins on startup
|
2024-10-17 09:37:51 +08:00 |
|
InfinityPacer
|
cf4c6b2d40
|
refactor(app): restructure project to avoid circular imports
|
2024-09-25 02:20:12 +08:00 |
|