From 917ce817a48c3e2129884692cce4498fbb486d42 Mon Sep 17 00:00:00 2001 From: Anton Melser Date: Fri, 6 Feb 2026 20:25:25 +0800 Subject: [PATCH] Update lastCommittedLsn after LSN committed Signed-off-by: Anton Melser --- packages/pglite-sync/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/pglite-sync/src/index.ts b/packages/pglite-sync/src/index.ts index 641dae7e5..95fd23c98 100644 --- a/packages/pglite-sync/src/index.ts +++ b/packages/pglite-sync/src/index.ts @@ -131,7 +131,7 @@ async function createPlugin( // We also have to track the last lsn that we have committed // This is across all shapes - const lastCommittedLsn: Lsn = subState?.last_lsn ?? BigInt(-1) + let lastCommittedLsn: Lsn = subState?.last_lsn ?? BigInt(-1) // We need our own aborter to be able to abort the streams but still accept the // signals from the user for each shape, and so we monitor the user provided signal @@ -320,6 +320,7 @@ async function createPlugin( debug, }) } + lastCommittedLsn = targetLsn if (unsubscribed) { await tx.rollback() }