MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getCurrentWalLsn

Function getCurrentWalLsn

packages/db/src/session-consistency.ts:45–57  ·  view source on GitHub ↗
(
  prismaClient: BarePrismaClient,
)

Source from the content-addressed store, hash-verified

43 READ_OPERATIONS.includes(operation as Operation);
44
45async function getCurrentWalLsn(
46 prismaClient: BarePrismaClient,
47): Promise<string | null> {
48 try {
49 const result = await prismaClient.$queryRaw<[{ lsn: string }]>`
50 SELECT pg_current_wal_lsn()::text AS lsn
51 `;
52 return result[0]?.lsn || null;
53 } catch (error) {
54 logger.error({ err: error }, 'Failed to get WAL LSN');
55 return null;
56 }
57}
58
59async function cacheWalLsnForSession(
60 sessionId: string,

Callers 2

waitForReplicaCatchupFunction · 0.85
sessionConsistencyFunction · 0.85

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected