mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-11 03:39:49 +08:00
refactor: 共享请求管道、按需懒加载、流式内存护栏与连接池治理
- 抽取 ApiRequestPipeline 单例,44 个路由文件共享同一实例 - Handler/Adapter 模块级 __getattr__ 延迟导入,减少启动时间 - 新增 ensure_stream_buffer_limit() 流式内存护栏(16MB 单行 / 32MB 总量) - HTTP 空闲连接清理与 curl_cffi LRU 会话池 - ensure_providers_bootstrapped 按需引导指定 provider_types - Usage 事件序列化迁移至 msgpack,Redis codec 隔离 - 启动预热任务(/readyz 就绪门控)与优雅关闭 - 通知邮件模块独立开关与 SMTP 配置校验 - CryptoService DCL 线程安全修复 - 通知模块开关 DB 查询 30s 内存缓存 - /readyz 对 unknown 状态返回 503 - 预热关闭 5s 超时保护 - 预热适配器逐个 try-except 容错 - FormatConversionRegistry 哨兵模式防并发重复物化 - 流式缓冲检查无条件执行 Closes #230 Co-authored-by: AAEE86 <[email protected]>
This commit is contained in:
@@ -57,11 +57,12 @@ async def test_executor_records_health_by_provider_format() -> None:
|
||||
patch("src.services.request.executor.RequestCandidateService.mark_candidate_started"),
|
||||
patch("src.services.request.executor.RequestCandidateService.mark_candidate_success"),
|
||||
patch("src.services.request.executor.get_adaptive_reservation_manager") as mock_res_mgr,
|
||||
patch("src.services.request.executor.health_monitor.record_success") as record_success,
|
||||
patch("src.services.request.executor.get_health_monitor") as mock_get_health_monitor,
|
||||
):
|
||||
mock_res_mgr.return_value.calculate_reservation.return_value = MagicMock(
|
||||
ratio=0.0, phase="stable", confidence=1.0
|
||||
)
|
||||
record_success = mock_get_health_monitor.return_value.record_success
|
||||
|
||||
executor = RequestExecutor(
|
||||
db=db, concurrency_manager=concurrency_manager, adaptive_manager=adaptive_manager
|
||||
@@ -100,8 +101,9 @@ async def test_error_classifier_records_failure_by_provider_format() -> None:
|
||||
key.id = "k1"
|
||||
|
||||
with patch(
|
||||
"src.services.orchestration.error_handler.health_monitor.record_failure"
|
||||
) as record_failure:
|
||||
"src.services.orchestration.error_handler.get_health_monitor"
|
||||
) as mock_get_health_monitor:
|
||||
record_failure = mock_get_health_monitor.return_value.record_failure
|
||||
await classifier.handle_retriable_error(
|
||||
error=RuntimeError("boom"),
|
||||
provider=provider,
|
||||
|
||||
Reference in New Issue
Block a user