Skip to content

Add 2s fetch timeout to getWebSearchStatus() - #2305

Merged
felladrin merged 1 commit into
mainfrom
fix/fetch-timeout-web-search-status
Aug 4, 2026
Merged

Add 2s fetch timeout to getWebSearchStatus()#2305
felladrin merged 1 commit into
mainfrom
fix/fetch-timeout-web-search-status

Conversation

@felladrin

Copy link
Copy Markdown
Owner

Closes #2287

Root cause

getWebSearchStatus() in server/webSearchService.ts called fetch("http://127.0.0.1:8888/healthz") with no timeout. If SearXNG accepts the TCP connection but never responds, the fetch blocks indefinitely and the /status handler never returns.

What changed

File Change
server/webSearchService.ts Wrap the /healthz fetch in AbortSignal.timeout(2000) so the health check aborts after 2s
server/webSearchService.test.ts Add a test simulating a hanging health endpoint, asserting getWebSearchStatus() returns false once the abort fires

How it was verified

  • npx vitest run server/webSearchService.test.ts → 3 files, 37 tests passed (includes the new hang-and-timeout test)
  • LSP diagnostics clean on both edited files

Wrap the /healthz fetch in AbortSignal.timeout(2000) so a hung SearXNG
health check aborts after 2s instead of blocking the /status handler
indefinitely. Add a test covering the hang-and-timeout path.

Fixes #2287
@felladrin
felladrin marked this pull request as ready for review August 4, 2026 23:52
@felladrin felladrin changed the title fix(webSearchService): add 2s fetch timeout to getWebSearchStatus() Add 2s fetch timeout to getWebSearchStatus() Aug 4, 2026
@felladrin
felladrin merged commit 607f1c9 into main Aug 4, 2026
7 checks passed
@felladrin
felladrin deleted the fix/fetch-timeout-web-search-status branch August 4, 2026 23:54
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.

Add fetch timeout to getWebSearchStatus() in webSearchService

1 participant