From 59436fbd433eb2b3de19e5877b392e1b911f5cf4 Mon Sep 17 00:00:00 2001 From: Georg Bremer Date: Wed, 26 Jun 2024 20:22:29 +0200 Subject: [PATCH] fix: Avoid adding embedding jobs without metadata id When no new metadata was inserted, the resulting empty array would be fully outer joined with the models, resulting in [undefined, 'ember_1'] pairs. --- packages/embedder/insertDiscussionsIntoMetadataAndQueue.ts | 4 ++-- .../embedder/insertMeetingTemplatesIntoMetadataAndQueue.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/embedder/insertDiscussionsIntoMetadataAndQueue.ts b/packages/embedder/insertDiscussionsIntoMetadataAndQueue.ts index 4383a670ff3..20b505880e6 100644 --- a/packages/embedder/insertDiscussionsIntoMetadataAndQueue.ts +++ b/packages/embedder/insertDiscussionsIntoMetadataAndQueue.ts @@ -35,9 +35,9 @@ export const insertDiscussionsIntoMetadataAndQueue = async ( .with('Metadata', (qc) => qc .selectFrom('Insert') - .fullJoin( + .innerJoin( sql<{model: string}>`UNNEST(ARRAY[${sql.join(tableNames)}])`.as('model'), - (join) => join.onTrue() + (join) => join.on('Insert.id', 'is not', null) ) .select(['id', 'model']) ) diff --git a/packages/embedder/insertMeetingTemplatesIntoMetadataAndQueue.ts b/packages/embedder/insertMeetingTemplatesIntoMetadataAndQueue.ts index 8e20cf6a370..082ede0cfd7 100644 --- a/packages/embedder/insertMeetingTemplatesIntoMetadataAndQueue.ts +++ b/packages/embedder/insertMeetingTemplatesIntoMetadataAndQueue.ts @@ -37,9 +37,9 @@ export const insertMeetingTemplatesIntoMetadataAndQueue = async ( .with('Metadata', (qc) => qc .selectFrom('Insert') - .fullJoin( + .innerJoin( sql<{model: string}>`UNNEST(ARRAY[${sql.join(tableNames)}])`.as('model'), - (join) => join.onTrue() + (join) => join.on('Insert.id', 'is not', null) ) .select(['id', 'model']) )