Skip to content

Commit 329b001

Browse files
committed
cleanup of dedupe keys lol
1 parent 061d955 commit 329b001

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

packages/migrations/src/actions/2025.12.12T00-00-00.workflows-deduplication.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ export default {
99
"expires_at" timestamptz NOT NULL,
1010
CONSTRAINT "dedupe_pk" PRIMARY KEY ("task_name", "dedupe_key")
1111
);
12+
13+
CREATE INDEX "graphile_worker_deduplication_expires_at_idx"
14+
ON "graphile_worker_deduplication" ("expires_at")
15+
;
1216
`,
1317
} satisfies MigrationExecutor;

packages/services/storage/src/db/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ export interface document_preflight_scripts {
135135
updated_at: Date;
136136
}
137137

138+
export interface graphile_worker_deduplication {
139+
dedupe_key: string;
140+
expires_at: Date;
141+
task_name: string;
142+
}
143+
138144
export interface migration {
139145
date: Date;
140146
hash: string;
@@ -441,6 +447,7 @@ export interface DBTables {
441447
document_collection_documents: document_collection_documents;
442448
document_collections: document_collections;
443449
document_preflight_scripts: document_preflight_scripts;
450+
graphile_worker_deduplication: graphile_worker_deduplication;
444451
migration: migration;
445452
oidc_integrations: oidc_integrations;
446453
organization_access_tokens: organization_access_tokens;

packages/services/workflows/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ const modules = await Promise.all([
4444
const crontab = `
4545
# Purge expired schema checks every Sunday at 10:00AM
4646
0 10 * * 0 purgeExpiredSchemaChecks
47+
# Every day at 3:00 AM
48+
0 3 * * * purgeExpiredDedupeKeys
4749
`;
4850

4951
const pg = await createPool(env.postgres.connectionString);

0 commit comments

Comments
 (0)