WeKnora/internal/datasource/connector
linus-liu-web a282d1091e
fix(feishu): 云盘分页补上 #3645 给 wiki 加的重复 page token 防护 (#3770)
ListDriveFilesAllPages 只以 next_page_token 是否为空作为终止条件,既不看
has_more,也没有重复 token 检测;同一文件里同一厂商的 ListWikiSpaces /
ListWikiNodes 已在 #3645 修过,云盘这两条防护都漏了。

厂商返回 has_more=false 但残留非空 token,或返回重复的 page_token 时,循环会
拿同一个 token 反复请求同一页:定时同步任务会在 asynq 的 2h 超时前一直打 API
(scheduler 侧 MaxRetry 5),资源选择器
GET /api/v1/datasources/:id/resources 永不返回,同时 all 每轮 append 不断增长。

按 #3645 的既有写法原样修复:listDriveFiles 透出 has_more,循环改为
if !hasMore || next == "" 才退出,并用 seenPageTokens 记录已用过的 token,重复即
返回 "feishu drive file pagination repeated page token" 错误。正常多页语义不变
(仍返回完整列表),只是不再空转。

测试:TestClientDriveListFilesPagination(drive 包)用 httptest 覆盖重复 token、
has_more=false 带残留 token、正常两页三种情况;注释掉守卫后该用例在 2s 内发出
4 万+ 次请求并以 context deadline exceeded 失败。

Co-authored-by: linus-liu-web <11640009+linus-liu-web@users.noreply.github.com>
2026-09-29 00:51:19 +08:00
..
confluence feat(confluence): add directory sync and private image assets (#3319) 2026-09-25 22:23:48 +08:00
dingtalk fix(datasource/dingtalk): 块级渲染不再静默丢内容(列表按线上真实形状渲染 + 未建模块类型可见) (#3822) 2026-09-29 00:48:20 +08:00
feishu fix(feishu): 云盘分页补上 #3645 给 wiki 加的重复 page token 防护 (#3770) 2026-09-29 00:51:19 +08:00
gitlab fix(gitlab): 按提交快照比较增量同步变更 2026-09-29 00:50:05 +08:00
ima fix(ima): traverse subfolders using list response media IDs 2026-09-19 22:42:57 +08:00
notion fix(notion): 在资源发现失败时中止增量同步 (#3682) 2026-09-25 18:47:38 +08:00
rss fix(rss): 拒绝超限响应以避免正文静默截断 2026-09-24 20:44:56 +08:00
yuque feat(datasource/yuque): preserve TOC folder hierarchy for synced documents (#3476) 2026-09-25 22:33:48 +08:00