Skip to content

Commit

Permalink
Merge pull request #1502 from contentstack/release/hotfix
Browse files Browse the repository at this point in the history
handling concurrency
  • Loading branch information
cs-raj committed Aug 5, 2024
2 parents 0664255 + d04a79f commit 3abd30c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions packages/contentstack-import/src/import/modules/base-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export default abstract class BaseClass {
.entry(apiData.entryUid)
.publish({
publishDetails: { environments: apiData.environments, locales: apiData.locales },
locale: additionalInfo.locale,
locale: apiData.locales[0],
})
.then(onSuccess)
.catch(onReject);
Expand All @@ -395,7 +395,7 @@ export default abstract class BaseClass {
.then(onSuccess)
.catch(onReject);
case 'import-taxonomy':
if(!apiData || !apiData.filePath){
if (!apiData || !apiData.filePath) {
return Promise.resolve();
}
return this.stack.taxonomy(uid).import({ taxonomy: apiData.filePath }).then(onSuccess).catch(onReject);
Expand Down
38 changes: 18 additions & 20 deletions packages/contentstack-import/src/import/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,26 +920,24 @@ export default class EntriesImport extends BaseClass {
apiContentDuplicate.push(c2);
});
});
for (let i = 0; i < apiContentDuplicate.length; i++) {
let apiContent = [apiContentDuplicate[i]];
await this.makeConcurrentCall({
apiContent,
processName,
indexerCount,
currentIndexer: +index,
apiParams: {
reject: onReject,
resolve: onSuccess,
entity: 'publish-entries',
includeParamOnCompletion: true,
serializeData: this.serializePublishEntries.bind(this),
additionalInfo: { contentType, locale: apiContentDuplicate[i]?.locale, cTUid },
},
concurrencyLimit: this.importConcurrency,
}).then(() => {
log(this.importConfig, `Published entries for content type ${cTUid} in locale ${locale}`, 'success');
});
}
apiContent = apiContentDuplicate;
await this.makeConcurrentCall({
apiContent,
processName,
indexerCount,
currentIndexer: +index,
apiParams: {
reject: onReject,
resolve: onSuccess,
entity: 'publish-entries',
includeParamOnCompletion: true,
serializeData: this.serializePublishEntries.bind(this),
additionalInfo: { contentType, locale, cTUid },
},
concurrencyLimit: this.importConcurrency,
}).then(() => {
log(this.importConfig, `Published entries for content type ${cTUid} in locale ${locale}`, 'success');
});
}
}
}
Expand Down

0 comments on commit 3abd30c

Please sign in to comment.