Skip to content

fix(desktop): 降低工作流链接生成请求风暴#24

Merged
earayu merged 1 commit into
mainfrom
codex/debounce-workflow-deeplink
May 28, 2026
Merged

fix(desktop): 降低工作流链接生成请求风暴#24
earayu merged 1 commit into
mainfrom
codex/debounce-workflow-deeplink

Conversation

@earayu
Copy link
Copy Markdown
Collaborator

@earayu earayu commented May 28, 2026

背景

3F 本地验证自有工作流保存时,创建工作流弹窗会在输入过程中持续调用 /recipes/encode 生成分享链接。当前现场出现 goosed 仍监听端口但所有请求超时的状态。

问题

CreateEditRecipeModal 在每次表单字段变化后立即发起 generateDeepLink(),没有防抖,也不会取消上一轮请求。长文本输入时会连续堆积 /recipes/encode 请求,可能把 renderer 到 goosed 的同源连接占满,随后保存、读取配置、列表等请求都表现为 Failed to fetch 或超时。

根因

分享链接生成是辅助展示功能,不应该在用户每次输入时无节制地并发请求后端。现有实现缺少防抖和取消机制。

方案

  • encodeRecipe / generateDeepLink 支持传入 AbortSignal
  • 创建工作流弹窗中,链接生成延迟 500ms
  • 字段继续变化或弹窗卸载时,取消上一轮未完成请求
  • 被取消的请求不再把 UI 标记成 Error generating deeplink

验收

  • pnpm -C ui/desktop exec eslint src/recipe/index.ts src/components/recipes/CreateEditRecipeModal.tsx --max-warnings 0 --no-warn-ignored 通过
  • git diff --check 通过

不解决什么

@earayu earayu merged commit b8edf7a into main May 28, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant