A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(api): rerun the ttl expiry pass when ttl tables change
Hampus902c38b34714
diff --git a/fluxer_api/src/api/database/PostgresKvDefaultTtlExpiry.ts b/fluxer_api/src/api/database/PostgresKvDefaultTtlExpiry.tsindex 3c806ba64..50d5e8056 100644--- a/fluxer_api/src/api/database/PostgresKvDefaultTtlExpiry.ts+++ b/fluxer_api/src/api/database/PostgresKvDefaultTtlExpiry.ts@@ -1,5 +1,6 @@// SPDX-License-Identifier: AGPL-3.0-or-later+import {createHash} from 'node:crypto';import {POSTGRES_KV_MIGRATION_TABLE,postgresKvPassRecorded,@@ -22,6 +23,16 @@ export const DEFAULT_TTL_TABLES: ReadonlyArray<{name: string; defaultTtlSeconds:),];+const DEFAULT_TTL_EXPIRY_MARKER = `default_ttl_expiry_v1:${createHash('sha256')+ .update(+ DEFAULT_TTL_TABLES.map((table) => `${table.name}:${table.defaultTtlSeconds}`)+ .sort()+ .join('\n'),+ )+ .digest('hex')+ .slice(0, 16)}`;+const DEFAULT_TTL_EXPIRY_RESUME = `${DEFAULT_TTL_EXPIRY_MARKER}_resume`;+export interface LegacyDefaultTtlExpiryResult {deleted: number;expiring: number;