Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

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

Hampus36b85512c651
diff --git a/fluxer_api/src/api/database/PostgresKvQueryExecutor.ts b/fluxer_api/src/api/database/PostgresKvQueryExecutor.ts
index 43912e71c..5bc84a191 100644
--- a/fluxer_api/src/api/database/PostgresKvQueryExecutor.ts
+++ b/fluxer_api/src/api/database/PostgresKvQueryExecutor.ts
@@ -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>;
}
diff --git a/fluxer_api/src/api/database/__testref__/LegacyPostgresKvQueryExecutor.ts b/fluxer_api/src/api/database/__testref__/LegacyPostgresKvQueryExecutor.ts
index 95639ca6c..0b9c7ecff 100644
--- a/fluxer_api/src/api/database/__testref__/LegacyPostgresKvQueryExecutor.ts
+++ b/fluxer_api/src/api/database/__testref__/LegacyPostgresKvQueryExecutor.ts
@@ -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;