What
The fetch call to the AI service in ai-client.ts has no signal (AbortController) or timeout configuration. If the AI service hangs, the request will block indefinitely (Node.js undici default timeout is very generous).
Why
While the caller (quizService.generateQuiz) catches errors and falls back to placeholder questions, a hung connection keeps a Node.js event loop reference and socket open. Under AI service degradation, this can exhaust sockets.
Scope
- Add an AbortController with a reasonable timeout (e.g., 30 seconds) to the fetch call
- Ensure the timeout is configurable
Acceptance Criteria
Technical Context
- File:
src/modules/quizzes/ai-client.ts, lines 28-38
- Consider using the existing
withTimeout utility from src/stellar/resilience.ts or a similar pattern
What
The
fetchcall to the AI service inai-client.tshas nosignal(AbortController) or timeout configuration. If the AI service hangs, the request will block indefinitely (Node.js undici default timeout is very generous).Why
While the caller (
quizService.generateQuiz) catches errors and falls back to placeholder questions, a hung connection keeps a Node.js event loop reference and socket open. Under AI service degradation, this can exhaust sockets.Scope
Acceptance Criteria
Technical Context
src/modules/quizzes/ai-client.ts, lines 28-38withTimeoututility fromsrc/stellar/resilience.tsor a similar pattern