fix(streaming): 从本地数据库读取超大群聊历史 - #635
Closed
Tyr1onX wants to merge 32 commits into
Closed
Conversation
|
@Tyr1onX is attempting to deploy a commit to the shuakami's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Fixes #634。
真实测试确认:任务在第 1 批、已写入 0 条时就触发 NapCat/QQ Worker 重启并丢失登录态,说明失败发生在 QQ 原生历史请求内部,早于磁盘落盘、解析、资源处理和 ZIP 生成。
根因
旧群聊流式抓取依赖以下 QQ 原生历史接口:
getAioFirstViewLatestMsgsgetMsgsIncludeSelf/getMsgHistorygetMsgsBySeqAndCount其中
getMsgHistory最终仍委托给getMsgsIncludeSelf,并不是独立 fallback;getMsgsBySeqAndCount在 NapCat 类型定义中已经标记为 deprecated。降低批次、串行化和禁止重试只能减轻压力,无法阻止第一次原生调用本身终止 Worker。当前修复
1. 群聊流式导出改为本地数据库分页
群聊流式路径已完全移除上述三个原生历史入口,改为:
MsgService.getLatestDbMsgs(peer, 1):只从 QQ 本地消息数据库取得最新消息和msgSeq;MsgService.queryMsgsWithFilterEx(...):以msgSeq为排他游标向更早消息分页;msgSeq移动,否则立即停止;getMsgHistory或getMsgsBySeqAndCount。2. 禁止并发和危险重试
3. 保留磁盘分块流水线
4. 删除第二条历史查询路径
安全分页完成后不再执行会重新访问群历史的
repair_group_message_sequence。解析、资源处理和导出阶段不会再次读取群历史。输出兼容性
普通 HTML/JSON/TXT/Excel 导出路径未修改。百万级流式 ZIP 需要完整解压后打开
index.html。验证
自动测试覆盖:
自动测试不能模拟提交者的 150 万条 QQ 本地数据库。CI 通过后仍需在原数据集上确认:已写入数量是否从 0 增长、Worker 是否保持登录、是否最终生成 ZIP。