fix(web): apply 15s timeout to all search engines (#2252 follow-up)#2259
Conversation
…ow-up) esengine#2252 added a 15s AbortSignal.timeout to searchBing; the other engines (Searxng, Metaso, Baidu, Tavily, Perplexity, Exa, Ollama, Brave) still relied on opts.signal only and could hang indefinitely. Extract searchSignal() helper that combines the caller's abort signal with a per-request SEARCH_TIMEOUT_MS cap, and apply it uniformly.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
esengine
left a comment
There was a problem hiding this comment.
Clean, correct follow-up to #2252. Extracting searchSignal(callerSignal) — which merges the caller's abort signal with AbortSignal.timeout(SEARCH_TIMEOUT_MS) via AbortSignal.any — and applying it to every engine (Searxng, Metaso, Baidu, Tavily, Perplexity, Exa, Ollama, Brave) closes the same indefinite-hang gap I just merged for Bing, and it folds the inline Bing timeout from #2252 into the shared helper so there's no duplication. The caller's cancellation is preserved in all paths. Single-file, CI green (build ubuntu+windows + CodeQL). LGTM.
问题
#2252 给
searchBing加了 15s 超时防止无限挂起,但其他搜索引擎(Searxng、Metaso、Baidu、Tavily、Perplexity、Exa、Ollama、Brave)仍然只依赖opts.signal,可能无限挂起。修复
提取
searchSignal()辅助函数,将 caller 的 abort 信号与SEARCH_TIMEOUT_MS(15s)合并,统一应用到所有搜索引擎。