Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ it.effect("prunes events the projections cover once the retained day has passed"
),
["Review prompt A. ".repeat(40)],
);

// A due pass cut short by a restart still moves the boundary to its own head a day later.
yield* sink.write({ events: [itemEvent(threadId, now, itemSpecs[0], 4)] });
const cutPassHead = yield* eventStore.latestSequence();
yield* TestClock.adjust("1 day");
yield* Effect.exit(maintenance.pruneEventStore(Effect.interrupt));
yield* TestClock.adjust("1 day");
yield* maintenance.pruneEventStore();
assert.equal(yield* events.prunedThroughSequence, cutPassHead);
}).pipe(Effect.provide(layerTest)),
);

Expand Down
5 changes: 4 additions & 1 deletion apps/server/src/orchestration-v2/ProjectionMaintenance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,12 @@ export const layer: Layer.Layer<ProjectionMaintenanceV2, never, SqlClient.SqlCli
// Publish the boundary first so resuming clients take a snapshot, never a partial replay.
yield* writeMetadata(EVENT_LOG_PRUNED_THROUGH, throughSequence, now);
}
// Written before the deletes: a pass cut short still advances the boundary a day later.
yield* writeMetadata(EVENT_LOG_PRUNE_MARK, head, now);
deletedEventCount += yield* pruneEvents(throughSequence, head, betweenPages);
} else if (mark === undefined) {
yield* writeMetadata(EVENT_LOG_PRUNE_MARK, head, now);
}
if (mark === undefined || markIsDue) yield* writeMetadata(EVENT_LOG_PRUNE_MARK, head, now);

const legacy = yield* pruneImportedLegacyHistory(
head,
Expand Down
Loading