Skip to content

Commit

Permalink
Merge pull request #1800 from Inist-CNRS/fix-enrichment-size
Browse files Browse the repository at this point in the history
fix: ensure BATCH_SIZE is a Number
  • Loading branch information
JulienMattiussi authored Nov 27, 2023
2 parents 12d34e6 + 23fb53e commit 96779db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/api/services/enrichment/enrichment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion src/app/js/admin/configTenant/ConfigTenantForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,10 @@ export const ConfigTenantForm = ({
<TextField
label="Enrichment Batch Size"
value={enrichmentBatchSize || ''}
type="number"
sx={{ mb: 2 }}
onChange={event => {
setEnrichmentBatchSize(event.target.value);
setEnrichmentBatchSize(Number(event.target.value));
}}
/>
<Box sx={{ mb: 10 }}>
Expand Down

0 comments on commit 96779db

Please sign in to comment.