summaryrefslogtreecommitdiff
path: root/internal/processor/processor.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-08 09:53:17 +0300
committerPaul Buetow <paul@buetow.org>2026-04-08 09:53:17 +0300
commitcd4265b8f87811db758c89bab5e62daa6c39337a (patch)
tree94c0a129b4b6ee9132baaa81eb3fbc96b083cbd4 /internal/processor/processor.go
parent7e7d34bfc0aec2aa8dff4cefa720e4a9b42d95d8 (diff)
feat(httpctx): add timeouts for OpenAI, Gemini, and HTTP downloads
Introduce internal/httpctx with non-zero http.Client timeouts for go-openai and google.golang.org/genai, shared image download client, and WithTimeoutUnlessSet for operation-level deadlines when callers use Background. Wire NewOpenAIClient/NewGenAIClient everywhere clients are constructed. Apply Search timeouts for DALL-E and Nano Banana, provider audio timeouts, model-list timeouts, Veo operation timeouts, story page download context, and single-word CLI processing cap. Made-with: Cursor
Diffstat (limited to 'internal/processor/processor.go')
-rw-r--r--internal/processor/processor.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/processor/processor.go b/internal/processor/processor.go
index 67dc897..433ef28 100644
--- a/internal/processor/processor.go
+++ b/internal/processor/processor.go
@@ -15,6 +15,7 @@ import (
"codeberg.org/snonux/totalrecall/internal/batch"
"codeberg.org/snonux/totalrecall/internal/cli"
"codeberg.org/snonux/totalrecall/internal/gui"
+ "codeberg.org/snonux/totalrecall/internal/httpctx"
"codeberg.org/snonux/totalrecall/internal/image"
"codeberg.org/snonux/totalrecall/internal/phonetic"
"codeberg.org/snonux/totalrecall/internal/store"
@@ -239,7 +240,9 @@ func (p *Processor) ProcessSingleWord(word string) error {
// ProcessWordWithTranslation processes a word with an optional provided English
// translation, using the default en-bg card type.
func (p *Processor) ProcessWordWithTranslation(word, providedTranslation string) error {
- return p.ProcessWordWithTranslationAndType(context.Background(), word, providedTranslation, internal.CardTypeEnBg)
+ ctx, cancel := context.WithTimeout(context.Background(), httpctx.SingleWordProcessTimeout)
+ defer cancel()
+ return p.ProcessWordWithTranslationAndType(ctx, word, providedTranslation, internal.CardTypeEnBg)
}
// ProcessWordWithTranslationAndType processes a word with optional provided