chore(api): drop knip-unused Postgres KV exports (#2119)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-30 18:58:50 +02:00
1 parent 14ae64f5f3
commit 36b85512c6
2 files changed
+2 -25

No files matched your search

@@ -28,7 +28,7 @@ export type CandidatePlan =
| {kind: 'partitionKeys'; partitionKeys: Array<string>}
| {kind: 'scan'};
export interface QueryPlan {
interface QueryPlan {
candidates: CandidatePlan;
exact: boolean;
}
@@ -43,7 +43,7 @@ interface QueryShape {
summary: string;
}
export interface PlanFragments {
interface PlanFragments {
predicate: string;
params: Array<unknown>;
}
@@ -339,29 +339,6 @@ WHERE table_name = 'messages'
});
}
export async function legacyPruneExpiredPostgresKvRows(client: IPostgresClient, batchSize = 5000): Promise<number> {
if (!Number.isInteger(batchSize) || batchSize <= 0) {
throw new Error('Postgres KV prune batch size must be a positive integer');
}
const table = quoteIdentifier(client.kvTable());
const result = await client.query(
`
WITH expired AS (
SELECT table_name, row_key
FROM ${table}
WHERE expires_at IS NOT NULL AND expires_at <= now()
ORDER BY expires_at
LIMIT $1
FOR UPDATE SKIP LOCKED
)
DELETE FROM ${table} kv
USING expired
WHERE kv.table_name = expired.table_name AND kv.row_key = expired.row_key`,
[batchSize],
);
return result.rowCount ?? 0;
}
export class LegacyPostgresKvQueryExecutor {
private readonly table: string;