Skip to content

Commit 3abd30c

Browse files
authored
Merge pull request #1502 from contentstack/release/hotfix
handling concurrency
2 parents 0664255 + d04a79f commit 3abd30c

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

packages/contentstack-import/src/import/modules/base-class.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ export default abstract class BaseClass {
374374
.entry(apiData.entryUid)
375375
.publish({
376376
publishDetails: { environments: apiData.environments, locales: apiData.locales },
377-
locale: additionalInfo.locale,
377+
locale: apiData.locales[0],
378378
})
379379
.then(onSuccess)
380380
.catch(onReject);
@@ -395,7 +395,7 @@ export default abstract class BaseClass {
395395
.then(onSuccess)
396396
.catch(onReject);
397397
case 'import-taxonomy':
398-
if(!apiData || !apiData.filePath){
398+
if (!apiData || !apiData.filePath) {
399399
return Promise.resolve();
400400
}
401401
return this.stack.taxonomy(uid).import({ taxonomy: apiData.filePath }).then(onSuccess).catch(onReject);

packages/contentstack-import/src/import/modules/entries.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -920,26 +920,24 @@ export default class EntriesImport extends BaseClass {
920920
apiContentDuplicate.push(c2);
921921
});
922922
});
923-
for (let i = 0; i < apiContentDuplicate.length; i++) {
924-
let apiContent = [apiContentDuplicate[i]];
925-
await this.makeConcurrentCall({
926-
apiContent,
927-
processName,
928-
indexerCount,
929-
currentIndexer: +index,
930-
apiParams: {
931-
reject: onReject,
932-
resolve: onSuccess,
933-
entity: 'publish-entries',
934-
includeParamOnCompletion: true,
935-
serializeData: this.serializePublishEntries.bind(this),
936-
additionalInfo: { contentType, locale: apiContentDuplicate[i]?.locale, cTUid },
937-
},
938-
concurrencyLimit: this.importConcurrency,
939-
}).then(() => {
940-
log(this.importConfig, `Published entries for content type ${cTUid} in locale ${locale}`, 'success');
941-
});
942-
}
923+
apiContent = apiContentDuplicate;
924+
await this.makeConcurrentCall({
925+
apiContent,
926+
processName,
927+
indexerCount,
928+
currentIndexer: +index,
929+
apiParams: {
930+
reject: onReject,
931+
resolve: onSuccess,
932+
entity: 'publish-entries',
933+
includeParamOnCompletion: true,
934+
serializeData: this.serializePublishEntries.bind(this),
935+
additionalInfo: { contentType, locale, cTUid },
936+
},
937+
concurrencyLimit: this.importConcurrency,
938+
}).then(() => {
939+
log(this.importConfig, `Published entries for content type ${cTUid} in locale ${locale}`, 'success');
940+
});
943941
}
944942
}
945943
}

0 commit comments

Comments
 (0)