From cd4265b8f87811db758c89bab5e62daa6c39337a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 8 Apr 2026 09:53:17 +0300 Subject: 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 --- internal/processor/processor.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'internal/processor/processor.go') 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 -- cgit v1.2.3