GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(server): the projection read path takes the lock on the reader connection by vifar · Pull Request #23689 · pingdotgg/t3code

perf(server): the projection read path takes the lock on the reader connection #23689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vifar wants to merge 8 commits into pingdotgg:main from vifar:perf/reader-connection-mcp-projection-reads

Uh oh!

There was an error while loading. Please reload this page.

Closed

perf(server): the projection read path takes the lock on the reader connection #23689

Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit Hold shift + click to select a range
8daf351
perf(server): the projection read path takes the lock on the reader c…
vifar Oct 22, 2026
e73f725
test(server): the load test's writer must actually write
vifar Oct 22, 2026
cdfa669
test(server): the load test's read must overlap the writes
vifar Oct 22, 2026
d91bce4
test(server): hold the write lock while the read runs, so the overlap…
vifar Oct 22, 2026
376e1ae
test(server): prove the write was in flight, and that the block was a…
vifar Oct 22, 2026
f266207
perf(server): the startup-recovery and settlement reads take the lock…
vifar Oct 22, 2026
095dece
Merge branch 'main' into perf/reader-connection-mcp-projection-reads
vifar Oct 22, 2026
ddc3c41
test(server): fix the typecheck errors the project's own CI found
vifar Oct 22, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

22 changes: 18 additions & 4 deletions 22 apps/server/src/orchestration-v2/ProjectionStore.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import * as Equal from "effect/Equal";
import * as Layer from "effect/Layer";
import * as Ref from "effect/Ref";
import * as Schema from "effect/Schema";
import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient";
import * as SqlClient from "effect/sql/SqlClient";
import type * as Statement from "effect/sql/Statement";

Expand Down Expand Up @@ -5245,6 +5246,10 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
filter,
) =>
sql.withTransaction(readCanonicalProjection(threadId, undefined, fields, filter)).pipe(
// The MCP read path runs this for every thread read. It is a pure
// read, so it belongs on the reader connection: on the writer it
// contends with the writes that the same load is producing.
NodeSqliteClient.readOnly,
Effect.map(
(projection) =>
Object.fromEntries([
Expand Down Expand Up @@ -6404,9 +6409,13 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
);

const getShellSnapshot: ProjectionStoreV2Shape["getShellSnapshot"] = (options) =>
sql
.withTransaction(readShellSnapshotRows(options))
.pipe(Effect.mapError(shellSnapshotReadError), Effect.flatMap(decodeShellSnapshot));
sql.withTransaction(readShellSnapshotRows(options)).pipe(
// A pure read: the shell list is read far more often than it is
// written, and on the writer it queues behind the writes.
NodeSqliteClient.readOnly,
Effect.mapError(shellSnapshotReadError),
Effect.flatMap(decodeShellSnapshot),
);

const getThreadShell: ProjectionStoreV2Shape["getThreadShell"] = (threadId) =>
sql
Expand Down Expand Up @@ -6480,7 +6489,12 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
});
}),
)
.pipe(Effect.mapError((cause) => new ProjectionStoreReadError({ threadId, cause })));
.pipe(
// A pure read: the shell row for one thread is read on every
// thread read, and on the writer it queues behind the writes.
NodeSqliteClient.readOnly,
Effect.mapError((cause) => new ProjectionStoreReadError({ threadId, cause })),
);

return {
apply,
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.