Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): batch projector cursor writes #9671

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/9671/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 4 changed files with 130 additions and 37 deletions (loading 2).

x
0 of 4 viewed, 4 left
115 additions and 32 deletionsapps/server/src/orchestration/Layers/ProjectionPipeline.test.tsModified
View file
@@ -20,6 +20,7 @@
import * as Path from "effect/Path";
import * as SqlClient from "effect/unstable/sql/SqlClient";
​
+import { makeSqlStatementCounter } from "../../../integration/SqlStatementCounter.integration.ts";
import { OrchestrationCommandReceiptRepositoryLive } from "../../persistence/Layers/OrchestrationCommandReceipts.ts";
import { OrchestrationEventStoreLive } from "../../persistence/Layers/OrchestrationEventStore.ts";
import {
@@ -27,6 +28,7 @@
SqlitePersistenceMemory,
} from "../../persistence/Layers/Sqlite.ts";
import { OrchestrationEventStore } from "../../persistence/Services/OrchestrationEventStore.ts";
+import { ProjectionStateRepository } from "../../persistence/Services/ProjectionState.ts";
import * as RepositoryIdentityResolver from "../../project/RepositoryIdentityResolver.ts";
import { OrchestrationEngineLive } from "./OrchestrationEngine.ts";
import {
@@ -58,6 +60,54 @@
​
const BaseTestLayer = makeProjectionPipelinePrefixedTestLayer("t3-projection-pipeline-test-");
​
+it.layer(Layer.fresh(makeProjectionPipelinePrefixedTestLayer("t3-projection-cursor-batch-")))(
+ "OrchestrationProjectionPipeline cursor batches",
+ (it) => {
+ it.effect("writes a project and all projector cursors in two statements", () =>
+ Effect.gen(function* () {
+ const projectionPipeline = yield* OrchestrationProjectionPipeline;
+ const eventStore = yield* OrchestrationEventStore;
+ const projectionState = yield* ProjectionStateRepository;