From 0f24263ad6132695234187f19c2d8d04648e0815 Mon Sep 17 00:00:00 2001 From: Nicolas Thouvenin Date: Fri, 24 Nov 2023 18:24:02 +0100 Subject: [PATCH 1/2] fix: ensure BATCH_SIZE is a Number --- src/api/services/enrichment/enrichment.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/services/enrichment/enrichment.js b/src/api/services/enrichment/enrichment.js index 2b0ff9f5f..6c2427f76 100644 --- a/src/api/services/enrichment/enrichment.js +++ b/src/api/services/enrichment/enrichment.js @@ -43,7 +43,8 @@ const getSourceData = async (ctx, sourceColumn) => { }; export const createEnrichmentRule = async (ctx, enrichment) => { - const { enrichmentBatchSize: BATCH_SIZE = 10 } = ctx.configTenant; + const { enrichmentBatchSize } = ctx.configTenant; + const BATCH_SIZE = Number(enrichmentBatchSize || 10); if (enrichment.advancedMode) { return enrichment; } @@ -67,7 +68,8 @@ const cleanWebServiceRule = rule => { }; export const getEnrichmentDataPreview = async ctx => { - const { enrichmentBatchSize: BATCH_SIZE = 10 } = ctx.configTenant; + const { enrichmentBatchSize } = ctx.configTenant; + const BATCH_SIZE = Number(enrichmentBatchSize || 10); const { sourceColumn, subPath, rule } = ctx.request.body; let previewRule = rule; if (!sourceColumn && !rule) { @@ -223,7 +225,8 @@ const processEzsEnrichment = (entries, commands, ctx, preview = false) => { }; export const processEnrichment = async (enrichment, ctx) => { - const { enrichmentBatchSize: BATCH_SIZE = 10 } = ctx.configTenant; + const { enrichmentBatchSize } = ctx.configTenant; + const BATCH_SIZE = Number(enrichmentBatchSize || 10); await ctx.enrichment.updateStatus(enrichment._id, IN_PROGRESS); let errorCount = 0; From 23fb53e574fa7aab7c68b478c9594c21f54a77b4 Mon Sep 17 00:00:00 2001 From: Anthony Rimet Date: Mon, 27 Nov 2023 11:48:33 +0100 Subject: [PATCH 2/2] Fix(config): Force type number on enrichment batch size: --- src/app/js/admin/configTenant/ConfigTenantForm.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/js/admin/configTenant/ConfigTenantForm.js b/src/app/js/admin/configTenant/ConfigTenantForm.js index 2b0af1322..58abff920 100644 --- a/src/app/js/admin/configTenant/ConfigTenantForm.js +++ b/src/app/js/admin/configTenant/ConfigTenantForm.js @@ -182,9 +182,10 @@ export const ConfigTenantForm = ({ { - setEnrichmentBatchSize(event.target.value); + setEnrichmentBatchSize(Number(event.target.value)); }} />