Skip to content

Make generateEmbeddings session timeout configurable#612

Open
surma wants to merge 1 commit intotobi:mainfrom
surma-dump:fix/embedding-session-timeout
Open

Make generateEmbeddings session timeout configurable#612
surma wants to merge 1 commit intotobi:mainfrom
surma-dump:fix/embedding-session-timeout

Conversation

@surma
Copy link
Copy Markdown
Contributor

@surma surma commented Apr 28, 2026

Make generateEmbeddings session timeout configurable (default: no timeout)

generateEmbeddings currently uses a hardcoded 30-minute maxDuration for its LLM session. On slower hardware — CPU-only embedding on a Raspberry Pi with 500+ documents, for example — this wall-clock limit is easily exceeded, causing the session to abort mid-run with:

⚠ Session expired — skipping 60 remaining chunks
⚠ Session expired — skipping remaining document batches

The timeout fires regardless of whether the session is actively doing work. Since embedding duration scales with corpus size and hardware speed, a fixed cap is the wrong constraint here.

This PR adds a maxDuration field to EmbedOptions (and the public QMDStore.embed() API), defaulting to 0 which disables the timer. Callers that want a safety timeout can pass one explicitly.

The session timeout machinery in LLMSession already handles maxDuration: 0 correctly (skips the setTimeout), so no changes to the session layer are needed.

…imeout

The embedding session had a hardcoded 30-minute maxDuration which causes
'Session expired' errors on slow hardware (e.g. CPU-only embedding on a
Raspberry Pi with 500+ documents). Since embedding duration is proportional
to corpus size and hardware speed, a fixed timeout is inappropriate.

Add a maxDuration parameter to EmbedOptions (and the public QMDStore.embed
API) that defaults to 0, which disables the timeout. Callers that want a
timeout (like the CLI) can pass one explicitly.
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.

1 participant