Refactor: split run_freshrss_pipeline into internal helpers

Extract three internal helpers to reduce the main function from ~330
lines to ~80 lines:
- _process_item(): handles per-item extract/summarize/filter/build
- _build_and_persist_delivery(): builds payload and persists keyword index
- _build_run_report(): assembles status counts and run report dict

No behavior changes. External signature and return shape unchanged.
This commit is contained in:
wdm
2026-03-29 16:27:11 +08:00
parent 78039eff47
commit 3d58408687
3 changed files with 279 additions and 135 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
## 重构建议(中等成本)
- [ ] `run_freshrss_pipeline` 函数过长(约300行)— 拆分为 `_process_single_item()`、`_build_and_persist_delivery()` 等内部函数,主函数只做编排
- [x] `run_freshrss_pipeline` 函数过长(约300行)— 拆分为 `_process_item()`、`_build_and_persist_delivery()`、`_build_run_report()` 三个内部函数,主函数只做编排(已完成)
- [ ] `load_filter_rules` 每次 pipeline 调用都重新读文件 — 加模块级缓存,MCP 服务长期运行时避免重复 I/O
## 功能补全