From 2bc82320e2cead47905f027b3fc3d1782d0958be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Sat, 7 Oct 2023 17:13:55 +0200 Subject: [PATCH] strict mode check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../src/database/operations/stitcher/markForStitching.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-backend/src/database/operations/stitcher/markForStitching.ts b/plugins/catalog-backend/src/database/operations/stitcher/markForStitching.ts index 9f4bcc49e7..ecc364a9cc 100644 --- a/plugins/catalog-backend/src/database/operations/stitcher/markForStitching.ts +++ b/plugins/catalog-backend/src/database/operations/stitcher/markForStitching.ts @@ -36,8 +36,9 @@ export async function markForStitching(options: { const entityRefs = split(options.entityRefs); const entityIds = split(options.entityIds); const knex = options.knex; + const mode = options.strategy.mode; - if (options.strategy.mode === 'immediate') { + if (mode === 'immediate') { for (const chunk of entityRefs) { await knex .table('final_entities') @@ -74,7 +75,7 @@ export async function markForStitching(options: { }) .whereIn('entity_id', chunk); } - } else { + } else if (mode === 'deferred') { // It's OK that this is shared across refresh state rows; it just needs to // be uniquely generated for every new stitch request. const ticket = uuid(); @@ -96,6 +97,8 @@ export async function markForStitching(options: { }) .whereIn('entity_id', chunk); } + } else { + throw new Error(`Unknown stitching strategy mode ${mode}`); } }