Skip to content

Add configurable query timeout for model document queries#208

Draft
vkarpov15 wants to merge 1 commit into
mainfrom
codex/add-configurable-query-timeout-feature
Draft

Add configurable query timeout for model document queries#208
vkarpov15 wants to merge 1 commit into
mainfrom
codex/add-configurable-query-timeout-feature

Conversation

@vkarpov15
Copy link
Copy Markdown
Member

Motivation

  • No skills were used for this change because it directly updates application frontend and backend code to expose a new user preference for query timeouts.
  • Prevent long-running MongoDB queries from blocking the UI by making document queries default to a short timeout and allowing users to adjust it per-browser.

Description

  • Add a per-browser query timeout preference with default 10 seconds stored under studio:model-query-timeout-seconds and exposed in the models UI as Query Timeout: X seconds in the 3-dot menu (opens a modal to edit and persist the value).
  • Wire the configured timeout into all document-fetch requests by adding maxTimeMS to the params produced by buildDocumentFetchParams() in frontend/src/models/models.js and passing maxTimeMS to API calls such as Model.getDocuments and streamed fetches.
  • Add backend support for the maxTimeMS parameter in Model.getDocuments and Model.getDocumentsStream and apply it via Mongoose's query.maxTimeMS() when provided and > 0.
  • Implement modal, state, load/save helpers, and validation in frontend/src/models/models.js and markup in frontend/src/models/models.html to configure the timeout.

Testing

  • Ran lint with npm run lint and it completed successfully.
  • Attempted unit tests with npm test -- --grep "Model.getDocuments()" but tests failed to run in this environment due to no MongoDB available (error: connection refused to 127.0.0.1:27017).

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio Ready Ready Preview, Comment Apr 4, 2026 8:28pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant