Skip to content

Move thread-list SQLite reads off the serving loop - #2936

Open
Guitaraholic wants to merge 1 commit into
get-bb:mainfrom
Guitaraholic:fix/sqlite-read-worker
Open

Move thread-list SQLite reads off the serving loop#2936
Guitaraholic wants to merge 1 commit into
get-bb:mainfrom
Guitaraholic:fix/sqlite-read-worker

Conversation

@Guitaraholic

Copy link
Copy Markdown

Human comments

What was wrong

better-sqlite3 runs on the Node serving loop. One cold query on a 1.7GB bb.db froze every client for 11s, including WebSocket token streams (#1131).

What changed

  • File-backed servers start one readonly WAL worker.
  • Thread list and sidebar project+thread reads go through it (listThreadsWithPendingInteractionStateOffThread and the project-scoped variant).
  • :memory: tests and a worker that fails to start keep the existing sync path.
  • Bundled servers also emit dist/sqlite-read-worker.js.
  • Search and timeline reads stay on the serving connection. No protocol change.

How you verified

  • Added packages/db/test/sqlite-read-queue.test.ts: in-memory stays on the calling connection; a file-backed worker returns the same thread list as the serving connection.
  • Desktop and app query tests for the other harvests passed in this checkout. Local db vitest workers OOM in this environment; CI should run the new file.

Fixes #1131

AGENT GENERATED

Synchronous better-sqlite3 on a large db froze every client. File-backed
servers now run one readonly WAL worker for thread list and sidebar
project+thread reads. In-memory tests and a worker that fails to start
keep the existing sync path.

Fixes get-bb#1131
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.

Synchronous SQLite on the event loop: one cold query froze all clients for 11s on a 1.7GB bb.db

1 participant